etlplus 0.11.1__py3-none-any.whl → 0.11.3__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 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 = coerce_file_format(file_format)
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 coerce_data_connector_type(source_type):
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
- # ``coerce_data_connector_type`` covers invalid entries, but keep
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/file/__init__.py CHANGED
@@ -9,7 +9,6 @@ from __future__ import annotations
9
9
  from .core import File
10
10
  from .enums import CompressionFormat
11
11
  from .enums import FileFormat
12
- from .enums import coerce_file_format
13
12
  from .enums import infer_file_format_and_compression
14
13
 
15
14
  # SECTION: EXPORTS ========================================================== #
@@ -22,6 +21,5 @@ __all__ = [
22
21
  'CompressionFormat',
23
22
  'FileFormat',
24
23
  # Functions
25
- 'coerce_file_format',
26
24
  'infer_file_format_and_compression',
27
25
  ]
etlplus/file/enums.py CHANGED
@@ -16,8 +16,6 @@ from ..types import StrStrMap
16
16
  __all__ = [
17
17
  'CompressionFormat',
18
18
  'FileFormat',
19
- 'coerce_compression_format',
20
- 'coerce_file_format',
21
19
  'infer_file_format_and_compression',
22
20
  ]
23
21
 
@@ -164,32 +162,6 @@ _COMPRESSION_FILE_FORMATS: set[FileFormat] = {
164
162
  # SECTION: FUNCTIONS ======================================================== #
165
163
 
166
164
 
167
- # TODO: Deprecate in favor of using the enum methods directly.
168
- def coerce_compression_format(
169
- compression_format: CompressionFormat | str,
170
- ) -> CompressionFormat:
171
- """
172
- Normalize textual compression format values to :class:`CompressionFormat`.
173
-
174
- This thin wrapper is kept for backward compatibility; prefer
175
- :meth:`CompressionFormat.coerce` going forward.
176
- """
177
- return CompressionFormat.coerce(compression_format)
178
-
179
-
180
- # TODO: Deprecate in favor of using the enum methods directly.
181
- def coerce_file_format(
182
- file_format: FileFormat | str,
183
- ) -> FileFormat:
184
- """
185
- Normalize textual file format values to :class:`FileFormat`.
186
-
187
- This thin wrapper is kept for backward compatibility; prefer
188
- :meth:`FileFormat.coerce` going forward.
189
- """
190
- return FileFormat.coerce(file_format)
191
-
192
-
193
165
  # TODO: Convert to a method on FileFormat or CompressionFormat?
194
166
  def infer_file_format_and_compression(
195
167
  value: object,
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 = coerce_file_format(ext) if ext else FileFormat.JSON
155
+ fmt = FileFormat.coerce(ext) if ext else FileFormat.JSON
159
156
  else:
160
- fmt = coerce_file_format(file_format)
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 = coerce_http_method(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 coerce_data_connector_type(target_type):
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
- # `coerce_data_connector_type` covers invalid entries, but keep
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
- stype = coerce_data_connector_type(stype_raw or '')
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
- # ``coerce_data_connector_type`` already raises for invalid
265
- # connector types; this branch is defensive only.
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
- ttype = coerce_data_connector_type(ttype_raw or '')
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
- # ``coerce_data_connector_type`` already raises for invalid
361
- # connector types; this branch is defensive only.
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etlplus
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary: A Swiss Army knife for simple ETL operations
5
5
  Home-page: https://github.com/Dagitali/ETLPlus
6
6
  Author: ETLPlus Team
@@ -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=r_KhmzIY-PSjfKfkz8uQtb_B5clfeTokRwqXreSWlNI,9150
5
- etlplus/extract.py,sha256=V1cifAktXW4BWyoaaJPgR6R_pAG6TPKq-XOzxb49_ic,6171
6
- etlplus/load.py,sha256=t9VfEuWyVq7MukuaLWrjj7oGyi6VDnXkiBXGPNAh1zE,8725
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=X4kp5FQlIWVf1_d9oSrchKau7BFDCE1Zkscvu7WPaWw,12340
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
@@ -51,10 +51,10 @@ etlplus/database/engine.py,sha256=7rr7YndA8LwyWJL8k1YhQbqxxmW4gWEUQjp0NwQcYtc,40
51
51
  etlplus/database/orm.py,sha256=gCSqH-CjQz6tV9133-VqgiwokK5ylun0BwXaIWfImAo,10008
52
52
  etlplus/database/schema.py,sha256=HNTgglI8qvQLInr7gq--2lLmLKHzAZTL2MJUOIw9DlY,7025
53
53
  etlplus/database/types.py,sha256=_pkQyC14TzAlgyeIqZG4F5LWYknZbHw3TW68Auk7Ya0,795
54
- etlplus/file/__init__.py,sha256=xd_Tvtzx7_PrGVb4Cjqp-v8p3P2qTPA3cZ14VzA1-0g,539
54
+ etlplus/file/__init__.py,sha256=X03bosSM-uSd6dh3ur0un6_ozFRw2Tm4PE6kVUjtXK8,475
55
55
  etlplus/file/core.py,sha256=NXTGSIKIo7HvLDlMtme37_d4NUhsf4RUNKp5mTj-wqU,8131
56
56
  etlplus/file/csv.py,sha256=VbMW_NaqCw03HlfvYzb9MoAgCXI3cl9qc4dASkTHoyw,1880
57
- etlplus/file/enums.py,sha256=NjgXQ0f53Xa1eyGKHvYkk58udjQI5TQfLVaoawfdXY0,7520
57
+ etlplus/file/enums.py,sha256=rwrbwj6PejG0c5v6jzcsmeNu9cSqDyWB1foIuM5UyJo,6648
58
58
  etlplus/file/json.py,sha256=xSV5PkZ_tZQuZNdLr1FQUwuCQXyL7Ch3WRJ3hkw0p68,1911
59
59
  etlplus/file/xml.py,sha256=vjate5u9Z26LPlpvZsdzpqXsIUZRgen7oHa3ly-aIhs,3905
60
60
  etlplus/file/yaml.py,sha256=6KaWoG7oYB26EHX2TZ7LOgigO11Hoq3MH--adFq_Eck,3004
@@ -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.1.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
67
- etlplus-0.11.1.dist-info/METADATA,sha256=zIJEvlxTNB13talthWkdGrbTWBNQZB8rkEn3Zwc9888,21036
68
- etlplus-0.11.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
69
- etlplus-0.11.1.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
70
- etlplus-0.11.1.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
71
- etlplus-0.11.1.dist-info/RECORD,,
66
+ etlplus-0.11.3.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
67
+ etlplus-0.11.3.dist-info/METADATA,sha256=Pyzi02lSbB6La48T-_qQvVXHb9kuJOIg31QPgX8V6Ig,21036
68
+ etlplus-0.11.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
69
+ etlplus-0.11.3.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
70
+ etlplus-0.11.3.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
71
+ etlplus-0.11.3.dist-info/RECORD,,