etlplus 0.10.1__py3-none-any.whl → 0.10.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
@@ -300,12 +300,16 @@ class FileFormat(CoercibleStrEnum):
300
300
  '.yml': 'yaml',
301
301
  # MIME types
302
302
  'application/avro': 'avro',
303
+ 'application/csv': 'csv',
303
304
  'application/feather': 'feather',
304
305
  'application/gzip': 'gz',
305
306
  'application/json': 'json',
306
307
  'application/jsonlines': 'ndjson',
307
308
  'application/ndjson': 'ndjson',
308
309
  'application/orc': 'orc',
310
+ 'application/parquet': 'parquet',
311
+ 'application/vnd.apache.avro': 'avro',
312
+ 'application/vnd.apache.parquet': 'parquet',
309
313
  'application/vnd.apache.arrow.file': 'feather',
310
314
  'application/vnd.apache.orc': 'orc',
311
315
  'application/vnd.ms-excel': 'xls',
@@ -314,13 +318,20 @@ class FileFormat(CoercibleStrEnum):
314
318
  'officedocument.spreadsheetml.sheet'
315
319
  ): 'xlsx',
316
320
  'application/x-avro': 'avro',
321
+ 'application/x-csv': 'csv',
322
+ 'application/x-feather': 'feather',
323
+ 'application/x-orc': 'orc',
317
324
  'application/x-ndjson': 'ndjson',
318
325
  'application/x-parquet': 'parquet',
326
+ 'application/x-yaml': 'yaml',
319
327
  'application/xml': 'xml',
320
328
  'application/zip': 'zip',
321
329
  'text/csv': 'csv',
322
330
  'text/plain': 'txt',
323
331
  'text/tab-separated-values': 'tsv',
332
+ 'text/tsv': 'tsv',
333
+ 'text/xml': 'xml',
334
+ 'text/yaml': 'yaml',
324
335
  }
325
336
 
326
337
 
@@ -524,6 +535,7 @@ def coerce_http_method(
524
535
 
525
536
  def infer_file_format_and_compression(
526
537
  value: object,
538
+ filename: object | None = None,
527
539
  ) -> tuple[FileFormat | None, CompressionFormat | None]:
528
540
  """
529
541
  Infer data format and compression from a filename, extension, or MIME type.
@@ -532,6 +544,9 @@ def infer_file_format_and_compression(
532
544
  ----------
533
545
  value : object
534
546
  A filename, extension, MIME type, or existing enum member.
547
+ filename : object | None, optional
548
+ A filename to consult for extension-based inference (e.g. when
549
+ ``value`` is ``application/octet-stream``).
535
550
 
536
551
  Returns
537
552
  -------
@@ -555,7 +570,25 @@ def infer_file_format_and_compression(
555
570
  compression = CompressionFormat.try_coerce(mime)
556
571
  fmt = FileFormat.try_coerce(mime)
557
572
 
558
- suffixes = PurePath(text).suffixes
573
+ is_mime = mime.startswith(
574
+ (
575
+ 'application/',
576
+ 'text/',
577
+ 'audio/',
578
+ 'image/',
579
+ 'video/',
580
+ 'multipart/',
581
+ ),
582
+ )
583
+ suffix_source: object | None = filename if filename is not None else text
584
+ if is_mime and filename is None:
585
+ suffix_source = None
586
+
587
+ suffixes = (
588
+ PurePath(str(suffix_source)).suffixes
589
+ if suffix_source is not None
590
+ else []
591
+ )
559
592
  if suffixes:
560
593
  normalized_suffixes = [suffix.casefold() for suffix in suffixes]
561
594
  compression = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etlplus
3
- Version: 0.10.1
3
+ Version: 0.10.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,7 +1,7 @@
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=yW-Um1fDQbW9p70ooM8dDTH7D0XBgmT-l3bF66N0AQc,14801
4
+ etlplus/enums.py,sha256=kcsKUIPTcX2vyOBZXbpkr4Gp5IOoXLD0zM-xaQa9USo,15883
5
5
  etlplus/extract.py,sha256=f44JdHhNTACxgn44USx05paKTwq7LQY-V4wANCW9hVM,6173
6
6
  etlplus/file.py,sha256=B-zebTrIFDKaaKzA9Fq5-L0JwDNYa2T--_6veR3N03s,17939
7
7
  etlplus/load.py,sha256=R_y0_vtsEo1bwxWVQu2bfhB5ZIJoIoWu2ycCdvY4RnE,8737
@@ -57,9 +57,9 @@ etlplus/templates/ddl.sql.j2,sha256=s8fMWvcb4eaJVXkifuib1aQPljtZ8buuyB_uA-ZdU3Q,
57
57
  etlplus/templates/view.sql.j2,sha256=Iy8DHfhq5yyvrUKDxqp_aHIEXY4Tm6j4wT7YDEFWAhk,2180
58
58
  etlplus/validation/__init__.py,sha256=Pe5Xg1_EA4uiNZGYu5WTF3j7odjmyxnAJ8rcioaplSQ,1254
59
59
  etlplus/validation/utils.py,sha256=Mtqg449VIke0ziy_wd2r6yrwJzQkA1iulZC87FzXMjo,10201
60
- etlplus-0.10.1.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
61
- etlplus-0.10.1.dist-info/METADATA,sha256=vjSqzhO6_KFW2lXvQgHGFOJDxOx-r4dSVef664jr1mU,21036
62
- etlplus-0.10.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
- etlplus-0.10.1.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
64
- etlplus-0.10.1.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
65
- etlplus-0.10.1.dist-info/RECORD,,
60
+ etlplus-0.10.3.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
61
+ etlplus-0.10.3.dist-info/METADATA,sha256=X0GNjIBJ1oRH6rp7_eJ4eEB72BjGOnP7Kg2Ha9SzLVU,21036
62
+ etlplus-0.10.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
+ etlplus-0.10.3.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
64
+ etlplus-0.10.3.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
65
+ etlplus-0.10.3.dist-info/RECORD,,