dc-python-sdk 1.5.50__tar.gz → 1.5.54__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {dc_python_sdk-1.5.50/src/dc_python_sdk.egg-info → dc_python_sdk-1.5.54}/PKG-INFO +17 -2
  2. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/README.md +13 -1
  3. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/pyproject.toml +7 -2
  4. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/setup.cfg +1 -1
  5. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54/src/dc_python_sdk.egg-info}/PKG-INFO +17 -2
  6. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_python_sdk.egg-info/SOURCES.txt +2 -0
  7. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_python_sdk.egg-info/requires.txt +4 -0
  8. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/errors.py +57 -1
  9. dc_python_sdk-1.5.54/src/dc_sdk/file_utils.py +1454 -0
  10. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/handler.py +3 -2
  11. dc_python_sdk-1.5.54/src/dc_sdk/json_safe.py +55 -0
  12. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/ai.py +4 -0
  13. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/ai_http.py +4 -0
  14. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/mapping.py +15 -5
  15. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/models/errors.py +49 -1
  16. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/pipeline.py +3 -2
  17. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/server.py +1 -1
  18. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/LICENSE +0 -0
  19. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_python_sdk.egg-info/dependency_links.txt +0 -0
  20. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_python_sdk.egg-info/entry_points.txt +0 -0
  21. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_python_sdk.egg-info/top_level.txt +0 -0
  22. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/__init__.py +0 -0
  23. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/app.py +0 -0
  24. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/cli.py +0 -0
  25. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/data_stream.py +0 -0
  26. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/__init__.py +0 -0
  27. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/connection_status.py +0 -0
  28. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/destination_object_template.py +0 -0
  29. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/models/__init__.py +0 -0
  30. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/models/enums.py +0 -0
  31. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/models/log_templates.py +0 -0
  32. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/models/pipeline_details.py +0 -0
  33. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/__init__.py +0 -0
  34. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/api.py +0 -0
  35. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/aws.py +0 -0
  36. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/environment.py +0 -0
  37. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/loader.py +0 -0
  38. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/logger.py +0 -0
  39. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/src/services/session.py +0 -0
  40. {dc_python_sdk-1.5.50 → dc_python_sdk-1.5.54}/src/dc_sdk/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dc-python-sdk
3
- Version: 1.5.50
3
+ Version: 1.5.54
4
4
  Summary: Data Connector Python SDK
5
5
  Home-page: https://github.com/data-connector/dc-python-sdk
6
6
  Author: DataConnector
@@ -26,6 +26,9 @@ Requires-Dist: numpy>=1.21.6; extra == "test"
26
26
  Requires-Dist: pandas>=1.3.5; extra == "test"
27
27
  Provides-Extra: ai
28
28
  Requires-Dist: openai; extra == "ai"
29
+ Provides-Extra: file
30
+ Requires-Dist: numpy>=1.21.6; extra == "file"
31
+ Requires-Dist: pandas>=1.3.5; extra == "file"
29
32
  Dynamic: license-file
30
33
 
31
34
  # Data Connector Python SDK
@@ -139,7 +142,7 @@ Our system uses the `dc_sdk` library to gracefully throw errors. This ensures:
139
142
 
140
143
  ## Error Categories
141
144
 
142
- The SDK provides 21 different error classes organized into logical categories. Each error is designed to handle specific failure scenarios:
145
+ The SDK provides 25 different error classes organized into logical categories. Each error is designed to handle specific failure scenarios:
143
146
 
144
147
  ### Authentication Errors
145
148
  - `AuthenticationError` - Invalid credentials, expired tokens
@@ -152,6 +155,8 @@ The SDK provides 21 different error classes organized into logical categories. E
152
155
  - `GetFieldsError` - Cannot retrieve field information
153
156
  - `BadFieldIDError` - Invalid field ID for object
154
157
  - `BadObjectIDError` - Object ID doesn't exist
158
+ - `FieldNotFoundError` - Requested fields are missing from a file or object
159
+ - `ObjectNotFoundError` - File or object could not be found at the source
155
160
 
156
161
  ### Data Filtering & Mapping Errors
157
162
  - `FilterDataTypeError` - Invalid data type for filtering
@@ -160,6 +165,7 @@ The SDK provides 21 different error classes organized into logical categories. E
160
165
 
161
166
  ### Data Retrieval Errors
162
167
  - `DataError` - Generic data retrieval failure
168
+ - `InvalidFileFormatError` - File could not be parsed or has no usable format
163
169
  - `APIRequestError` - API returned error status
164
170
  - `APITimeoutError` - Request timeout
165
171
  - `APIPermissionError` - Insufficient API permissions
@@ -172,6 +178,15 @@ The SDK provides 21 different error classes organized into logical categories. E
172
178
 
173
179
  ### Implementation Errors
174
180
  - `NotImplementedError` - Required method not implemented
181
+ - `FileUtilsDependencyError` - Connector imported `dc_sdk.file_utils` without installing pandas/numpy
182
+
183
+ File connectors can share parsing helpers with:
184
+
185
+ ```python
186
+ from dc_sdk.file_utils import FileConnectorUtilis
187
+ ```
188
+
189
+ That import is optional. Connectors that use it must also install pandas and numpy (for example `pip install pandas numpy`). Other connectors should keep importing `from dc_sdk import errors` only, so they never load pandas.
175
190
 
176
191
  For detailed examples and usage patterns, see the [Examples](#examples) section below.
177
192
 
@@ -109,7 +109,7 @@ Our system uses the `dc_sdk` library to gracefully throw errors. This ensures:
109
109
 
110
110
  ## Error Categories
111
111
 
112
- The SDK provides 21 different error classes organized into logical categories. Each error is designed to handle specific failure scenarios:
112
+ The SDK provides 25 different error classes organized into logical categories. Each error is designed to handle specific failure scenarios:
113
113
 
114
114
  ### Authentication Errors
115
115
  - `AuthenticationError` - Invalid credentials, expired tokens
@@ -122,6 +122,8 @@ The SDK provides 21 different error classes organized into logical categories. E
122
122
  - `GetFieldsError` - Cannot retrieve field information
123
123
  - `BadFieldIDError` - Invalid field ID for object
124
124
  - `BadObjectIDError` - Object ID doesn't exist
125
+ - `FieldNotFoundError` - Requested fields are missing from a file or object
126
+ - `ObjectNotFoundError` - File or object could not be found at the source
125
127
 
126
128
  ### Data Filtering & Mapping Errors
127
129
  - `FilterDataTypeError` - Invalid data type for filtering
@@ -130,6 +132,7 @@ The SDK provides 21 different error classes organized into logical categories. E
130
132
 
131
133
  ### Data Retrieval Errors
132
134
  - `DataError` - Generic data retrieval failure
135
+ - `InvalidFileFormatError` - File could not be parsed or has no usable format
133
136
  - `APIRequestError` - API returned error status
134
137
  - `APITimeoutError` - Request timeout
135
138
  - `APIPermissionError` - Insufficient API permissions
@@ -142,6 +145,15 @@ The SDK provides 21 different error classes organized into logical categories. E
142
145
 
143
146
  ### Implementation Errors
144
147
  - `NotImplementedError` - Required method not implemented
148
+ - `FileUtilsDependencyError` - Connector imported `dc_sdk.file_utils` without installing pandas/numpy
149
+
150
+ File connectors can share parsing helpers with:
151
+
152
+ ```python
153
+ from dc_sdk.file_utils import FileConnectorUtilis
154
+ ```
155
+
156
+ That import is optional. Connectors that use it must also install pandas and numpy (for example `pip install pandas numpy`). Other connectors should keep importing `from dc_sdk import errors` only, so they never load pandas.
145
157
 
146
158
  For detailed examples and usage patterns, see the [Examples](#examples) section below.
147
159
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dc-python-sdk"
7
- version = "1.5.50"
7
+ version = "1.5.54"
8
8
  description = "Data Connector Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6"
@@ -38,6 +38,11 @@ ai = [
38
38
  "openai",
39
39
  ]
40
40
 
41
+ file = [
42
+ "numpy>=1.21.6",
43
+ "pandas>=1.3.5",
44
+ ]
45
+
41
46
  [project.urls]
42
47
  "Bug Tracker" = "https://github.com/data-connector/dc-python-sdk/issues"
43
48
 
@@ -49,4 +54,4 @@ where = ["src"]
49
54
 
50
55
  [tool.pytest.ini_options]
51
56
  pythonpath = ["src", "tests"]
52
- testpaths = ["tests"]
57
+ testpaths = ["tests"]
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = dc-python-sdk
3
- version = 1.5.50
3
+ version = 1.5.54
4
4
  author = DataConnector
5
5
  author_email = josh@dataconnector.com
6
6
  description = A small example package
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dc-python-sdk
3
- Version: 1.5.50
3
+ Version: 1.5.54
4
4
  Summary: Data Connector Python SDK
5
5
  Home-page: https://github.com/data-connector/dc-python-sdk
6
6
  Author: DataConnector
@@ -26,6 +26,9 @@ Requires-Dist: numpy>=1.21.6; extra == "test"
26
26
  Requires-Dist: pandas>=1.3.5; extra == "test"
27
27
  Provides-Extra: ai
28
28
  Requires-Dist: openai; extra == "ai"
29
+ Provides-Extra: file
30
+ Requires-Dist: numpy>=1.21.6; extra == "file"
31
+ Requires-Dist: pandas>=1.3.5; extra == "file"
29
32
  Dynamic: license-file
30
33
 
31
34
  # Data Connector Python SDK
@@ -139,7 +142,7 @@ Our system uses the `dc_sdk` library to gracefully throw errors. This ensures:
139
142
 
140
143
  ## Error Categories
141
144
 
142
- The SDK provides 21 different error classes organized into logical categories. Each error is designed to handle specific failure scenarios:
145
+ The SDK provides 25 different error classes organized into logical categories. Each error is designed to handle specific failure scenarios:
143
146
 
144
147
  ### Authentication Errors
145
148
  - `AuthenticationError` - Invalid credentials, expired tokens
@@ -152,6 +155,8 @@ The SDK provides 21 different error classes organized into logical categories. E
152
155
  - `GetFieldsError` - Cannot retrieve field information
153
156
  - `BadFieldIDError` - Invalid field ID for object
154
157
  - `BadObjectIDError` - Object ID doesn't exist
158
+ - `FieldNotFoundError` - Requested fields are missing from a file or object
159
+ - `ObjectNotFoundError` - File or object could not be found at the source
155
160
 
156
161
  ### Data Filtering & Mapping Errors
157
162
  - `FilterDataTypeError` - Invalid data type for filtering
@@ -160,6 +165,7 @@ The SDK provides 21 different error classes organized into logical categories. E
160
165
 
161
166
  ### Data Retrieval Errors
162
167
  - `DataError` - Generic data retrieval failure
168
+ - `InvalidFileFormatError` - File could not be parsed or has no usable format
163
169
  - `APIRequestError` - API returned error status
164
170
  - `APITimeoutError` - Request timeout
165
171
  - `APIPermissionError` - Insufficient API permissions
@@ -172,6 +178,15 @@ The SDK provides 21 different error classes organized into logical categories. E
172
178
 
173
179
  ### Implementation Errors
174
180
  - `NotImplementedError` - Required method not implemented
181
+ - `FileUtilsDependencyError` - Connector imported `dc_sdk.file_utils` without installing pandas/numpy
182
+
183
+ File connectors can share parsing helpers with:
184
+
185
+ ```python
186
+ from dc_sdk.file_utils import FileConnectorUtilis
187
+ ```
188
+
189
+ That import is optional. Connectors that use it must also install pandas and numpy (for example `pip install pandas numpy`). Other connectors should keep importing `from dc_sdk import errors` only, so they never load pandas.
175
190
 
176
191
  For detailed examples and usage patterns, see the [Examples](#examples) section below.
177
192
 
@@ -13,7 +13,9 @@ src/dc_sdk/app.py
13
13
  src/dc_sdk/cli.py
14
14
  src/dc_sdk/data_stream.py
15
15
  src/dc_sdk/errors.py
16
+ src/dc_sdk/file_utils.py
16
17
  src/dc_sdk/handler.py
18
+ src/dc_sdk/json_safe.py
17
19
  src/dc_sdk/types.py
18
20
  src/dc_sdk/src/__init__.py
19
21
  src/dc_sdk/src/ai.py
@@ -9,6 +9,10 @@ pycryptodome
9
9
  [ai]
10
10
  openai
11
11
 
12
+ [file]
13
+ numpy>=1.21.6
14
+ pandas>=1.3.5
15
+
12
16
  [test]
13
17
  python-dotenv>=0.20.0
14
18
  faker>=13.12.0
@@ -9,7 +9,9 @@ class Error(Exception):
9
9
  self.internal = internal
10
10
 
11
11
  def __str__(self):
12
- return self.error_name + self.message
12
+ name = self.error_name if self.error_name is not None else type(self).__name__
13
+ msg = self.message if self.message is not None else ""
14
+ return f"{name}{msg}"
13
15
 
14
16
  def to_dict(self):
15
17
  return {
@@ -35,6 +37,8 @@ class AuthenticationError(Error):
35
37
 
36
38
  :param message: An error message - WILL BE VISIBLE TO CLIENT
37
39
  """
40
+ if not message:
41
+ message = "Authentication failed."
38
42
  super().__init__(message, self.error_name, self.internal)
39
43
  self.message = message
40
44
  self.error_name = "Authentication Error - "
@@ -340,6 +344,54 @@ class NoRowsFoundError(Error):
340
344
  self.internal = True
341
345
 
342
346
 
347
+ class InvalidFileFormatError(Error):
348
+ """Raised when a file object cannot be parsed or has no usable format."""
349
+ error_name = "Invalid File Format Error - "
350
+ internal = False
351
+
352
+ def __init__(self, message=None):
353
+ super().__init__(message, self.error_name, self.internal)
354
+ self.message = message
355
+ self.error_name = "Invalid File Format Error - "
356
+ self.internal = False
357
+
358
+
359
+ class FieldNotFoundError(Error):
360
+ """Raised when requested fields are not present in a file or object."""
361
+ error_name = "Field Not Found Error - "
362
+ internal = False
363
+
364
+ def __init__(self, message=None):
365
+ super().__init__(message, self.error_name, self.internal)
366
+ self.message = message
367
+ self.error_name = "Field Not Found Error - "
368
+ self.internal = False
369
+
370
+
371
+ class ObjectNotFoundError(Error):
372
+ """Raised when a file or object id cannot be found at the source."""
373
+ error_name = "Object Not Found Error - "
374
+ internal = False
375
+
376
+ def __init__(self, message=None):
377
+ super().__init__(message, self.error_name, self.internal)
378
+ self.message = message
379
+ self.error_name = "Object Not Found Error - "
380
+ self.internal = False
381
+
382
+
383
+ class FileUtilsDependencyError(Error):
384
+ """Raised when a connector imports file utils without pandas/numpy installed."""
385
+ error_name = "File Utils Dependency Error - "
386
+ internal = False
387
+
388
+ def __init__(self, message=None):
389
+ super().__init__(message, self.error_name, self.internal)
390
+ self.message = message
391
+ self.error_name = "File Utils Dependency Error - "
392
+ self.internal = False
393
+
394
+
343
395
  def external_errors():
344
396
  error_list = []
345
397
  classes = [cls[1] for cls in inspect.getmembers(sys.modules[__name__],
@@ -373,4 +425,8 @@ ERROR_MAPPING = {
373
425
  "NotADestinationError": NotADestinationError,
374
426
  "NotImplementedError": NotImplementedError,
375
427
  "NoRowsFoundError": NoRowsFoundError,
428
+ "InvalidFileFormatError": InvalidFileFormatError,
429
+ "FieldNotFoundError": FieldNotFoundError,
430
+ "ObjectNotFoundError": ObjectNotFoundError,
431
+ "FileUtilsDependencyError": FileUtilsDependencyError,
376
432
  }