etlplus 0.11.1__py3-none-any.whl → 0.11.2__py3-none-any.whl
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.
- etlplus/enums.py +0 -30
- etlplus/extract.py +4 -6
- etlplus/load.py +6 -9
- etlplus/run.py +6 -9
- {etlplus-0.11.1.dist-info → etlplus-0.11.2.dist-info}/METADATA +1 -1
- {etlplus-0.11.1.dist-info → etlplus-0.11.2.dist-info}/RECORD +10 -10
- {etlplus-0.11.1.dist-info → etlplus-0.11.2.dist-info}/WHEEL +0 -0
- {etlplus-0.11.1.dist-info → etlplus-0.11.2.dist-info}/entry_points.txt +0 -0
- {etlplus-0.11.1.dist-info → etlplus-0.11.2.dist-info}/licenses/LICENSE +0 -0
- {etlplus-0.11.1.dist-info → etlplus-0.11.2.dist-info}/top_level.txt +0 -0
etlplus/enums.py
CHANGED
|
@@ -26,9 +26,6 @@ __all__ = [
|
|
|
26
26
|
'HttpMethod',
|
|
27
27
|
'OperatorName',
|
|
28
28
|
'PipelineStep',
|
|
29
|
-
# Functions
|
|
30
|
-
'coerce_data_connector_type',
|
|
31
|
-
'coerce_http_method',
|
|
32
29
|
]
|
|
33
30
|
|
|
34
31
|
|
|
@@ -341,30 +338,3 @@ _PIPELINE_ORDER_INDEX: dict[PipelineStep, int] = {
|
|
|
341
338
|
PipelineStep.SORT: 3,
|
|
342
339
|
PipelineStep.AGGREGATE: 4,
|
|
343
340
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
# SECTION: FUNCTIONS ======================================================== #
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
def coerce_data_connector_type(
|
|
350
|
-
connector: DataConnectorType | str,
|
|
351
|
-
) -> DataConnectorType:
|
|
352
|
-
"""
|
|
353
|
-
Normalize textual data connector values to :class:`DataConnectorType`.
|
|
354
|
-
|
|
355
|
-
This thin wrapper is kept for backward compatibility; prefer
|
|
356
|
-
:meth:`DataConnectorType.coerce` going forward.
|
|
357
|
-
"""
|
|
358
|
-
return DataConnectorType.coerce(connector)
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
def coerce_http_method(
|
|
362
|
-
http_method: HttpMethod | str,
|
|
363
|
-
) -> HttpMethod:
|
|
364
|
-
"""
|
|
365
|
-
Normalize textual HTTP method values to :class:`HttpMethod`.
|
|
366
|
-
|
|
367
|
-
This thin wrapper is kept for backward compatibility; prefer
|
|
368
|
-
:meth:`HttpMethod.coerce` going forward.
|
|
369
|
-
"""
|
|
370
|
-
return HttpMethod.coerce(http_method)
|
etlplus/extract.py
CHANGED
|
@@ -14,10 +14,8 @@ import requests # type: ignore[import]
|
|
|
14
14
|
|
|
15
15
|
from .enums import DataConnectorType
|
|
16
16
|
from .enums import HttpMethod
|
|
17
|
-
from .enums import coerce_data_connector_type
|
|
18
17
|
from .file import File
|
|
19
18
|
from .file import FileFormat
|
|
20
|
-
from .file import coerce_file_format
|
|
21
19
|
from .types import JSONData
|
|
22
20
|
from .types import JSONDict
|
|
23
21
|
from .types import JSONList
|
|
@@ -55,7 +53,7 @@ def extract_from_file(
|
|
|
55
53
|
# If no explicit format is provided, let File infer from extension.
|
|
56
54
|
if file_format is None:
|
|
57
55
|
return File(path, None).read()
|
|
58
|
-
fmt =
|
|
56
|
+
fmt = FileFormat.coerce(file_format)
|
|
59
57
|
|
|
60
58
|
# Let file module perform existence and format validation.
|
|
61
59
|
return File(path, fmt).read()
|
|
@@ -202,7 +200,7 @@ def extract(
|
|
|
202
200
|
ValueError
|
|
203
201
|
If `source_type` is not one of the supported values.
|
|
204
202
|
"""
|
|
205
|
-
match
|
|
203
|
+
match DataConnectorType.coerce(source_type):
|
|
206
204
|
case DataConnectorType.FILE:
|
|
207
205
|
# Prefer explicit format if provided, else infer from filename.
|
|
208
206
|
return extract_from_file(source, file_format)
|
|
@@ -213,6 +211,6 @@ def extract(
|
|
|
213
211
|
# ``file_format`` is ignored for APIs.
|
|
214
212
|
return extract_from_api(str(source), **kwargs)
|
|
215
213
|
case _:
|
|
216
|
-
#
|
|
217
|
-
# explicit guard for defensive programming.
|
|
214
|
+
# :meth:`coerce` already raises for invalid connector types, but
|
|
215
|
+
# keep explicit guard for defensive programming.
|
|
218
216
|
raise ValueError(f'Invalid source type: {source_type}')
|
etlplus/load.py
CHANGED
|
@@ -16,11 +16,8 @@ import requests # type: ignore[import]
|
|
|
16
16
|
|
|
17
17
|
from .enums import DataConnectorType
|
|
18
18
|
from .enums import HttpMethod
|
|
19
|
-
from .enums import coerce_data_connector_type
|
|
20
|
-
from .enums import coerce_http_method
|
|
21
19
|
from .file import File
|
|
22
20
|
from .file import FileFormat
|
|
23
|
-
from .file import coerce_file_format
|
|
24
21
|
from .types import JSONData
|
|
25
22
|
from .types import JSONDict
|
|
26
23
|
from .types import JSONList
|
|
@@ -155,9 +152,9 @@ def load_to_file(
|
|
|
155
152
|
if file_format is None:
|
|
156
153
|
records = File(path).write(data)
|
|
157
154
|
ext = path.suffix.lstrip('.').lower()
|
|
158
|
-
fmt =
|
|
155
|
+
fmt = FileFormat.coerce(ext) if ext else FileFormat.JSON
|
|
159
156
|
else:
|
|
160
|
-
fmt =
|
|
157
|
+
fmt = FileFormat.coerce(file_format)
|
|
161
158
|
records = File(path, fmt).write(data)
|
|
162
159
|
if fmt is FileFormat.CSV and records == 0:
|
|
163
160
|
message = 'No data to write'
|
|
@@ -242,7 +239,7 @@ def load_to_api(
|
|
|
242
239
|
TypeError
|
|
243
240
|
If the session object is not valid.
|
|
244
241
|
"""
|
|
245
|
-
http_method =
|
|
242
|
+
http_method = HttpMethod.coerce(method)
|
|
246
243
|
|
|
247
244
|
# Apply a conservative timeout to guard against hanging requests.
|
|
248
245
|
timeout = kwargs.pop('timeout', 10.0)
|
|
@@ -316,7 +313,7 @@ def load(
|
|
|
316
313
|
"""
|
|
317
314
|
data = load_data(source)
|
|
318
315
|
|
|
319
|
-
match
|
|
316
|
+
match DataConnectorType.coerce(target_type):
|
|
320
317
|
case DataConnectorType.FILE:
|
|
321
318
|
# Prefer explicit format if provided, else infer from filename.
|
|
322
319
|
return load_to_file(data, target, file_format)
|
|
@@ -331,6 +328,6 @@ def load(
|
|
|
331
328
|
**kwargs,
|
|
332
329
|
)
|
|
333
330
|
case _:
|
|
334
|
-
# `
|
|
335
|
-
# explicit guard.
|
|
331
|
+
# :meth:`coerce` already raises for invalid connector types, but
|
|
332
|
+
# keep explicit guard for defensive programming.
|
|
336
333
|
raise ValueError(f'Invalid target type: {target_type}')
|
etlplus/run.py
CHANGED
|
@@ -23,7 +23,6 @@ from .api import RetryPolicy
|
|
|
23
23
|
from .api import Url
|
|
24
24
|
from .config import load_pipeline_config
|
|
25
25
|
from .enums import DataConnectorType
|
|
26
|
-
from .enums import coerce_data_connector_type
|
|
27
26
|
from .extract import extract
|
|
28
27
|
from .load import load
|
|
29
28
|
from .run_helpers import compose_api_request_env
|
|
@@ -185,8 +184,7 @@ def run(
|
|
|
185
184
|
|
|
186
185
|
data: Any
|
|
187
186
|
stype_raw = getattr(source_obj, 'type', None)
|
|
188
|
-
|
|
189
|
-
match stype:
|
|
187
|
+
match DataConnectorType.coerce(stype_raw or ''):
|
|
190
188
|
case DataConnectorType.FILE:
|
|
191
189
|
path = getattr(source_obj, 'path', None)
|
|
192
190
|
fmt = ex_opts.get('format') or getattr(
|
|
@@ -261,8 +259,8 @@ def run(
|
|
|
261
259
|
sleep_seconds=cast(float, env.get('sleep_seconds', 0.0)),
|
|
262
260
|
)
|
|
263
261
|
case _:
|
|
264
|
-
#
|
|
265
|
-
#
|
|
262
|
+
# :meth:`coerce` already raises for invalid connector types, but
|
|
263
|
+
# keep explicit guard for defensive programming.
|
|
266
264
|
raise ValueError(f'Unsupported source type: {stype_raw}')
|
|
267
265
|
|
|
268
266
|
# DRY: unified validation helper (pre/post transform)
|
|
@@ -318,8 +316,7 @@ def run(
|
|
|
318
316
|
overrides = job_obj.load.overrides or {}
|
|
319
317
|
|
|
320
318
|
ttype_raw = getattr(target_obj, 'type', None)
|
|
321
|
-
|
|
322
|
-
match ttype:
|
|
319
|
+
match DataConnectorType.coerce(ttype_raw or ''):
|
|
323
320
|
case DataConnectorType.FILE:
|
|
324
321
|
path = overrides.get('path') or getattr(target_obj, 'path', None)
|
|
325
322
|
fmt = overrides.get('format') or getattr(
|
|
@@ -357,8 +354,8 @@ def run(
|
|
|
357
354
|
)
|
|
358
355
|
result = load(data, 'database', str(conn))
|
|
359
356
|
case _:
|
|
360
|
-
#
|
|
361
|
-
#
|
|
357
|
+
# :meth:`coerce` already raises for invalid connector types, but
|
|
358
|
+
# keep explicit guard for defensive programming.
|
|
362
359
|
raise ValueError(f'Unsupported target type: {ttype_raw}')
|
|
363
360
|
|
|
364
361
|
# Return the terminal load result directly; callers (e.g., CLI) can wrap
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
etlplus/__init__.py,sha256=M2gScnyir6WOMAh_EuoQIiAzdcTls0_5hbd_Q6of8I0,1021
|
|
2
2
|
etlplus/__main__.py,sha256=btoROneNiigyfBU7BSzPKZ1R9gzBMpxcpsbPwmuHwTM,479
|
|
3
3
|
etlplus/__version__.py,sha256=1E0GMK_yUWCMQFKxXjTvyMwofi0qT2k4CDNiHWiymWE,327
|
|
4
|
-
etlplus/enums.py,sha256=
|
|
5
|
-
etlplus/extract.py,sha256=
|
|
6
|
-
etlplus/load.py,sha256=
|
|
4
|
+
etlplus/enums.py,sha256=WyxpUEUPdYdXlueKDXGaSEo7o9OqCXyzjDOOPqmW8tw,8326
|
|
5
|
+
etlplus/extract.py,sha256=LOyL8_KCOaIGemTxSnKbN_ttfLWUljqT4OQxANe7G3k,6089
|
|
6
|
+
etlplus/load.py,sha256=aufl-2CpuI_J1hKBY1uFsoVf9Gfl9bKQjs233dYFf00,8631
|
|
7
7
|
etlplus/mixins.py,sha256=ifGpHwWv7U00yqGf-kN93vJax2IiK4jaGtTsPsO3Oak,1350
|
|
8
8
|
etlplus/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
etlplus/run.py,sha256=
|
|
9
|
+
etlplus/run.py,sha256=FjcMF56HUbSw2PAvB_dZWP-xTFP-Pa_QLYTsrjmFurw,12262
|
|
10
10
|
etlplus/run_helpers.py,sha256=bj6MkaeFxjl3CeKG1HoXKx5DwAlXNERVW-GX-z1P_qQ,24373
|
|
11
11
|
etlplus/transform.py,sha256=uAUVDDHYCgx7GpVez9IK3OAZM-CnCuMa9iox3vwGGJA,25296
|
|
12
12
|
etlplus/types.py,sha256=1hsDlnF6r76zAwaUYay-i6pCM-Y0IU5nP7Crj8PLCQ4,6157
|
|
@@ -63,9 +63,9 @@ etlplus/templates/ddl.sql.j2,sha256=s8fMWvcb4eaJVXkifuib1aQPljtZ8buuyB_uA-ZdU3Q,
|
|
|
63
63
|
etlplus/templates/view.sql.j2,sha256=Iy8DHfhq5yyvrUKDxqp_aHIEXY4Tm6j4wT7YDEFWAhk,2180
|
|
64
64
|
etlplus/validation/__init__.py,sha256=Pe5Xg1_EA4uiNZGYu5WTF3j7odjmyxnAJ8rcioaplSQ,1254
|
|
65
65
|
etlplus/validation/utils.py,sha256=Mtqg449VIke0ziy_wd2r6yrwJzQkA1iulZC87FzXMjo,10201
|
|
66
|
-
etlplus-0.11.
|
|
67
|
-
etlplus-0.11.
|
|
68
|
-
etlplus-0.11.
|
|
69
|
-
etlplus-0.11.
|
|
70
|
-
etlplus-0.11.
|
|
71
|
-
etlplus-0.11.
|
|
66
|
+
etlplus-0.11.2.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
|
|
67
|
+
etlplus-0.11.2.dist-info/METADATA,sha256=3I2djs1HEPyMy31qvH5oSlolJRgXi6qKXcjcLdLhFig,21036
|
|
68
|
+
etlplus-0.11.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
69
|
+
etlplus-0.11.2.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
|
|
70
|
+
etlplus-0.11.2.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
|
|
71
|
+
etlplus-0.11.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|