etlplus 0.12.9__py3-none-any.whl → 0.12.11__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.
Files changed (59) hide show
  1. etlplus/file/accdb.py +78 -0
  2. etlplus/file/arrow.py +78 -0
  3. etlplus/file/avro.py +13 -1
  4. etlplus/file/bson.py +77 -0
  5. etlplus/file/cbor.py +78 -0
  6. etlplus/file/cfg.py +79 -0
  7. etlplus/file/conf.py +80 -0
  8. etlplus/file/csv.py +13 -1
  9. etlplus/file/dat.py +13 -1
  10. etlplus/file/dta.py +77 -0
  11. etlplus/file/duckdb.py +78 -0
  12. etlplus/file/enums.py +10 -4
  13. etlplus/file/feather.py +13 -1
  14. etlplus/file/fwf.py +12 -1
  15. etlplus/file/hbs.py +78 -0
  16. etlplus/file/hdf5.py +78 -0
  17. etlplus/file/ini.py +79 -0
  18. etlplus/file/ion.py +78 -0
  19. etlplus/file/jinja2.py +78 -0
  20. etlplus/file/json.py +13 -1
  21. etlplus/file/log.py +78 -0
  22. etlplus/file/mat.py +78 -0
  23. etlplus/file/mdb.py +78 -0
  24. etlplus/file/msgpack.py +78 -0
  25. etlplus/file/mustache.py +78 -0
  26. etlplus/file/nc.py +78 -0
  27. etlplus/file/ndjson.py +12 -6
  28. etlplus/file/numbers.py +75 -0
  29. etlplus/file/ods.py +79 -0
  30. etlplus/file/orc.py +13 -1
  31. etlplus/file/parquet.py +13 -1
  32. etlplus/file/pb.py +78 -0
  33. etlplus/file/pbf.py +77 -0
  34. etlplus/file/properties.py +78 -0
  35. etlplus/file/proto.py +77 -0
  36. etlplus/file/psv.py +14 -1
  37. etlplus/file/rda.py +78 -0
  38. etlplus/file/rds.py +78 -0
  39. etlplus/file/sas7bdat.py +78 -0
  40. etlplus/file/sav.py +77 -0
  41. etlplus/file/sqlite.py +78 -0
  42. etlplus/file/sylk.py +77 -0
  43. etlplus/file/tab.py +3 -4
  44. etlplus/file/toml.py +78 -0
  45. etlplus/file/tsv.py +14 -1
  46. etlplus/file/txt.py +11 -1
  47. etlplus/file/vm.py +78 -0
  48. etlplus/file/wks.py +77 -0
  49. etlplus/file/xlsm.py +79 -0
  50. etlplus/file/xml.py +12 -1
  51. etlplus/file/xpt.py +78 -0
  52. etlplus/file/yaml.py +12 -1
  53. etlplus/file/zsav.py +77 -0
  54. {etlplus-0.12.9.dist-info → etlplus-0.12.11.dist-info}/METADATA +31 -1
  55. {etlplus-0.12.9.dist-info → etlplus-0.12.11.dist-info}/RECORD +59 -22
  56. {etlplus-0.12.9.dist-info → etlplus-0.12.11.dist-info}/WHEEL +0 -0
  57. {etlplus-0.12.9.dist-info → etlplus-0.12.11.dist-info}/entry_points.txt +0 -0
  58. {etlplus-0.12.9.dist-info → etlplus-0.12.11.dist-info}/licenses/LICENSE +0 -0
  59. {etlplus-0.12.9.dist-info → etlplus-0.12.11.dist-info}/top_level.txt +0 -0
etlplus/file/enums.py CHANGED
@@ -66,8 +66,8 @@ class FileFormat(CoercibleStrEnum):
66
66
 
67
67
  # Tabular & delimited text
68
68
  CSV = 'csv' # Comma-Separated Values
69
- FWF = 'fwf' # Fixed-Width Formatted
70
69
  DAT = 'dat' # Generic data file, often delimited or fixed-width
70
+ FWF = 'fwf' # Fixed-Width Formatted
71
71
  PSV = 'psv' # Pipe-Separated Values
72
72
  TAB = 'tab' # Often synonymous with TSV
73
73
  TSV = 'tsv' # Tab-Separated Values
@@ -79,7 +79,7 @@ class FileFormat(CoercibleStrEnum):
79
79
  INI = 'ini' # INI-style key-value pairs
80
80
  JSON = 'json' # JavaScript Object Notation
81
81
  NDJSON = 'ndjson' # Newline-Delimited JSON
82
- PROPS = 'properties' # Java-style key-value pairs
82
+ PROPERTIES = 'properties' # Java-style key-value pairs
83
83
  TOML = 'toml' # Tom's Obvious Minimal Language
84
84
  XML = 'xml' # Extensible Markup Language
85
85
  YAML = 'yaml' # YAML Ain't Markup Language
@@ -108,7 +108,7 @@ class FileFormat(CoercibleStrEnum):
108
108
 
109
109
  # Spreadsheets
110
110
  NUMBERS = 'numbers' # Apple Numbers spreadsheet
111
- ODS = 'ods' # OpenDocument Spreadsheet
111
+ ODS = 'ods' # OpenDocument spreadsheet
112
112
  WKS = 'wks' # Lotus 1-2-3 spreadsheet
113
113
  XLS = 'xls' # Microsoft Excel (BIFF); read-only
114
114
  XLSM = 'xlsm' # Microsoft Excel Macro-Enabled (Open XML)
@@ -116,7 +116,7 @@ class FileFormat(CoercibleStrEnum):
116
116
 
117
117
  # Statistical / scientific / numeric computing
118
118
  DTA = 'dta' # Stata data file
119
- H5 = 'h5' # Hierarchical Data Format
119
+ HDF5 = 'hdf5' # Hierarchical Data Format
120
120
  MAT = 'mat' # MATLAB data file
121
121
  NC = 'nc' # NetCDF data file
122
122
  RDA = 'rda' # RData workspace/object bundle
@@ -175,6 +175,12 @@ class FileFormat(CoercibleStrEnum):
175
175
 
176
176
  # Domain-specific & less common
177
177
 
178
+ # Templates
179
+ HBS = 'hbs' # Handlebars
180
+ JINJA2 = 'jinja2' # Jinja2
181
+ MUSTACHE = 'mustache' # Mustache
182
+ VM = 'vm' # Apache Velocity
183
+
178
184
  # -- Class Methods -- #
179
185
 
180
186
  @classmethod
etlplus/file/feather.py CHANGED
@@ -1,7 +1,19 @@
1
1
  """
2
2
  :mod:`etlplus.file.feather` module.
3
3
 
4
- Helpers for reading/writing Feather files.
4
+ Helpers for reading/writing Apache Arrow Feather (FEATHER) files.
5
+
6
+ Notes
7
+ -----
8
+ - A FEATHER file is a binary file format designed for efficient
9
+ on-disk storage of data frames, built on top of Apache Arrow.
10
+ - Common cases:
11
+ - Fast read/write operations for data frames.
12
+ - Interoperability between different data analysis tools.
13
+ - Storage of large datasets with efficient compression.
14
+ - Rule of thumb:
15
+ - If the file follows the Apache Arrow Feather specification, use this
16
+ module for reading and writing.
5
17
  """
6
18
 
7
19
  from __future__ import annotations
etlplus/file/fwf.py CHANGED
@@ -1,7 +1,18 @@
1
1
  """
2
2
  :mod:`etlplus.file.fwf` module.
3
3
 
4
- Helpers for reading/writing FWF (fixed-width fields) files.
4
+ Helpers for reading/writing Fixed-Width Fields (FWF) files.
5
+
6
+ Notes
7
+ -----
8
+ - An FWF file is a text file format where each field has a fixed width.
9
+ - Common cases:
10
+ - Data files from legacy systems.
11
+ - Reports with aligned columns.
12
+ - Data exchange in mainframe environments.
13
+ - Rule of thumb:
14
+ - If the file follows the FWF specification, use this module for
15
+ reading and writing.
5
16
  """
6
17
 
7
18
  from __future__ import annotations
etlplus/file/hbs.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ :mod:`etlplus.file.hbs` module.
3
+
4
+ Helpers for reading/writing Handlebars (HBS) template files.
5
+
6
+ Notes
7
+ -----
8
+ - A Handlebars (HBS) template file is a text file used for generating HTML or
9
+ other text formats by combining templates with data.
10
+ - Common cases:
11
+ - HTML templates.
12
+ - Email templates.
13
+ - Configuration files.
14
+ - Rule of thumb:
15
+ - If you need to work with Handlebars template files, use this module for
16
+ reading and writing.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pathlib import Path
22
+
23
+ from ..types import JSONData
24
+ from ..types import JSONList
25
+ from . import stub
26
+
27
+ # SECTION: EXPORTS ========================================================== #
28
+
29
+
30
+ __all__ = [
31
+ 'read',
32
+ 'write',
33
+ ]
34
+
35
+
36
+ # SECTION: FUNCTIONS ======================================================== #
37
+
38
+
39
+ def read(
40
+ path: Path,
41
+ ) -> JSONList:
42
+ """
43
+ Read ZSAV content from ``path``.
44
+
45
+ Parameters
46
+ ----------
47
+ path : Path
48
+ Path to the HBS file on disk.
49
+
50
+ Returns
51
+ -------
52
+ JSONList
53
+ The list of dictionaries read from the HBS file.
54
+ """
55
+ return stub.read(path, format_name='HBS')
56
+
57
+
58
+ def write(
59
+ path: Path,
60
+ data: JSONData,
61
+ ) -> int:
62
+ """
63
+ Write ``data`` to HBS file at ``path`` and return record count.
64
+
65
+ Parameters
66
+ ----------
67
+ path : Path
68
+ Path to the HBS file on disk.
69
+ data : JSONData
70
+ Data to write as HBS file. Should be a list of dictionaries or a
71
+ single dictionary.
72
+
73
+ Returns
74
+ -------
75
+ int
76
+ The number of rows written to the HBS file.
77
+ """
78
+ return stub.write(path, data, format_name='HBS')
etlplus/file/hdf5.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ :mod:`etlplus.file.hdf5` module.
3
+
4
+ Helpers for reading/writing Hierarchical Data Format (HDF5) files.
5
+
6
+ Notes
7
+ -----
8
+ - A HDF5 file is a binary file format designed to store and organize large
9
+ amounts of data.
10
+ - Common cases:
11
+ - Scientific data storage and sharing.
12
+ - Large-scale data analysis.
13
+ - Hierarchical data organization.
14
+ - Rule of thumb:
15
+ - If the file follows the HDF5 specification, use this module for reading
16
+ and writing.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pathlib import Path
22
+
23
+ from ..types import JSONData
24
+ from ..types import JSONList
25
+ from . import stub
26
+
27
+ # SECTION: EXPORTS ========================================================== #
28
+
29
+
30
+ __all__ = [
31
+ 'read',
32
+ 'write',
33
+ ]
34
+
35
+
36
+ # SECTION: FUNCTIONS ======================================================== #
37
+
38
+
39
+ def read(
40
+ path: Path,
41
+ ) -> JSONList:
42
+ """
43
+ Read HDF5 content from ``path``.
44
+
45
+ Parameters
46
+ ----------
47
+ path : Path
48
+ Path to the HDF5 file on disk.
49
+
50
+ Returns
51
+ -------
52
+ JSONList
53
+ The list of dictionaries read from the HDF5 file.
54
+ """
55
+ return stub.read(path, format_name='HDF5')
56
+
57
+
58
+ def write(
59
+ path: Path,
60
+ data: JSONData,
61
+ ) -> int:
62
+ """
63
+ Write ``data`` to HDF5 file at ``path`` and return record count.
64
+
65
+ Parameters
66
+ ----------
67
+ path : Path
68
+ Path to the HDF5 file on disk.
69
+ data : JSONData
70
+ Data to write as HDF5 file. Should be a list of dictionaries or a
71
+ single dictionary.
72
+
73
+ Returns
74
+ -------
75
+ int
76
+ The number of rows written to the HDF5 file.
77
+ """
78
+ return stub.write(path, data, format_name='HDF5')
etlplus/file/ini.py ADDED
@@ -0,0 +1,79 @@
1
+ """
2
+ :mod:`etlplus.file.ini` module.
3
+
4
+ Helpers for reading/writing initialization (INI) files.
5
+
6
+ Notes
7
+ -----
8
+ - An INI file is a simple configuration file format that uses sections,
9
+ properties, and values.
10
+ - Common cases:
11
+ - Sections are denoted by square brackets (e.g., ``[section]``).
12
+ - Properties are key-value pairs (e.g., ``key=value``).
13
+ - Comments are often indicated by semicolons (``;``) or hash symbols
14
+ (``#``).
15
+ - Rule of thumb:
16
+ - If the file follows the INI specification, use this module for
17
+ reading and writing.
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ from pathlib import Path
23
+
24
+ from ..types import JSONData
25
+ from ..types import JSONList
26
+ from . import stub
27
+
28
+ # SECTION: EXPORTS ========================================================== #
29
+
30
+
31
+ __all__ = [
32
+ 'read',
33
+ 'write',
34
+ ]
35
+
36
+
37
+ # SECTION: FUNCTIONS ======================================================== #
38
+
39
+
40
+ def read(
41
+ path: Path,
42
+ ) -> JSONList:
43
+ """
44
+ Read INI content from ``path``.
45
+
46
+ Parameters
47
+ ----------
48
+ path : Path
49
+ Path to the INI file on disk.
50
+
51
+ Returns
52
+ -------
53
+ JSONList
54
+ The list of dictionaries read from the INI file.
55
+ """
56
+ return stub.read(path, format_name='INI')
57
+
58
+
59
+ def write(
60
+ path: Path,
61
+ data: JSONData,
62
+ ) -> int:
63
+ """
64
+ Write ``data`` to INI at ``path`` and return record count.
65
+
66
+ Parameters
67
+ ----------
68
+ path : Path
69
+ Path to the INI file on disk.
70
+ data : JSONData
71
+ Data to write as INI. Should be a list of dictionaries or a
72
+ single dictionary.
73
+
74
+ Returns
75
+ -------
76
+ int
77
+ The number of rows written to the INI file.
78
+ """
79
+ return stub.write(path, data, format_name='INI')
etlplus/file/ion.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ :mod:`etlplus.file.ion` module.
3
+
4
+ Helpers for reading/writing Amazon Ion (ION) files.
5
+
6
+ Notes
7
+ -----
8
+ - An ION file is a richly-typed, self-describing data format developed by
9
+ Amazon, designed for efficient data interchange and storage.
10
+ - Common cases:
11
+ - Data serialization for distributed systems.
12
+ - Interoperability between different programming languages.
13
+ - Handling of complex data types beyond standard JSON capabilities.
14
+ - Rule of thumb:
15
+ - If the file follows the Amazon Ion specification, use this module for
16
+ reading and writing.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pathlib import Path
22
+
23
+ from ..types import JSONData
24
+ from ..types import JSONList
25
+ from . import stub
26
+
27
+ # SECTION: EXPORTS ========================================================== #
28
+
29
+
30
+ __all__ = [
31
+ 'read',
32
+ 'write',
33
+ ]
34
+
35
+
36
+ # SECTION: FUNCTIONS ======================================================== #
37
+
38
+
39
+ def read(
40
+ path: Path,
41
+ ) -> JSONList:
42
+ """
43
+ Read ION content from ``path``.
44
+
45
+ Parameters
46
+ ----------
47
+ path : Path
48
+ Path to the ION file on disk.
49
+
50
+ Returns
51
+ -------
52
+ JSONList
53
+ The list of dictionaries read from the ION file.
54
+ """
55
+ return stub.read(path, format_name='ION')
56
+
57
+
58
+ def write(
59
+ path: Path,
60
+ data: JSONData,
61
+ ) -> int:
62
+ """
63
+ Write ``data`` to ION at ``path`` and return record count.
64
+
65
+ Parameters
66
+ ----------
67
+ path : Path
68
+ Path to the ION file on disk.
69
+ data : JSONData
70
+ Data to write as ION. Should be a list of dictionaries or a
71
+ single dictionary.
72
+
73
+ Returns
74
+ -------
75
+ int
76
+ The number of rows written to the ION file.
77
+ """
78
+ return stub.write(path, data, format_name='ION')
etlplus/file/jinja2.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ :mod:`etlplus.file.jinja2` module.
3
+
4
+ Helpers for reading/writing compressed Jinja2 (JINJA2) template files.
5
+
6
+ Notes
7
+ -----
8
+ - A JINJA2 file is a text file used for generating HTML or other text formats
9
+ by combining templates with data.
10
+ - Common cases:
11
+ - HTML templates.
12
+ - Email templates.
13
+ - Configuration files.
14
+ - Rule of thumb:
15
+ - If you need to work with Jinja2 template files, use this module for
16
+ reading and writing.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pathlib import Path
22
+
23
+ from ..types import JSONData
24
+ from ..types import JSONList
25
+ from . import stub
26
+
27
+ # SECTION: EXPORTS ========================================================== #
28
+
29
+
30
+ __all__ = [
31
+ 'read',
32
+ 'write',
33
+ ]
34
+
35
+
36
+ # SECTION: FUNCTIONS ======================================================== #
37
+
38
+
39
+ def read(
40
+ path: Path,
41
+ ) -> JSONList:
42
+ """
43
+ Read JINJA2 content from ``path``.
44
+
45
+ Parameters
46
+ ----------
47
+ path : Path
48
+ Path to the JINJA2 file on disk.
49
+
50
+ Returns
51
+ -------
52
+ JSONList
53
+ The list of dictionaries read from the JINJA2 file.
54
+ """
55
+ return stub.read(path, format_name='JINJA2')
56
+
57
+
58
+ def write(
59
+ path: Path,
60
+ data: JSONData,
61
+ ) -> int:
62
+ """
63
+ Write ``data`` to JINJA2 file at ``path`` and return record count.
64
+
65
+ Parameters
66
+ ----------
67
+ path : Path
68
+ Path to the JINJA2 file on disk.
69
+ data : JSONData
70
+ Data to write as JINJA2 file. Should be a list of dictionaries or a
71
+ single dictionary.
72
+
73
+ Returns
74
+ -------
75
+ int
76
+ The number of rows written to the JINJA2 file.
77
+ """
78
+ return stub.write(path, data, format_name='JINJA2')
etlplus/file/json.py CHANGED
@@ -1,7 +1,19 @@
1
1
  """
2
2
  :mod:`etlplus.file.json` module.
3
3
 
4
- Helpers for reading/writing JSON files.
4
+ Helpers for reading/writing JavaScript Object Notation (JSON) files.
5
+
6
+ Notes
7
+ -----
8
+ - A JSON file is a widely used data interchange format that uses
9
+ human-readable text to represent structured data.
10
+ - Common cases:
11
+ - Data interchange between web applications and servers.
12
+ - Configuration files for applications.
13
+ - Data storage for NoSQL databases.
14
+ - Rule of thumb:
15
+ - If the file follows the JSON specification, use this module for
16
+ reading and writing.
5
17
  """
6
18
 
7
19
  from __future__ import annotations
etlplus/file/log.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ :mod:`etlplus.file.log` module.
3
+
4
+ Helpers for reading/writing generic log (LOG) files.
5
+
6
+ Notes
7
+ -----
8
+ - A LOG file is a plain text file that contains log messages generated by
9
+ applications or systems.
10
+ - Common cases:
11
+ - Each line in the file represents a single log entry.
12
+ - Log entries may include timestamps, log levels, and messages.
13
+ - Formats may vary widely depending on the application generating the logs.
14
+ - Rule of thumb:
15
+ - If the file is a generic log file, use this module for reading and
16
+ writing.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pathlib import Path
22
+
23
+ from ..types import JSONData
24
+ from ..types import JSONList
25
+ from . import stub
26
+
27
+ # SECTION: EXPORTS ========================================================== #
28
+
29
+
30
+ __all__ = [
31
+ 'read',
32
+ 'write',
33
+ ]
34
+
35
+
36
+ # SECTION: FUNCTIONS ======================================================== #
37
+
38
+
39
+ def read(
40
+ path: Path,
41
+ ) -> JSONList:
42
+ """
43
+ Read LOG content from ``path``.
44
+
45
+ Parameters
46
+ ----------
47
+ path : Path
48
+ Path to the LOG file on disk.
49
+
50
+ Returns
51
+ -------
52
+ JSONList
53
+ The list of dictionaries read from the LOG file.
54
+ """
55
+ return stub.read(path, format_name='LOG')
56
+
57
+
58
+ def write(
59
+ path: Path,
60
+ data: JSONData,
61
+ ) -> int:
62
+ """
63
+ Write ``data`` to LOG at ``path`` and return record count.
64
+
65
+ Parameters
66
+ ----------
67
+ path : Path
68
+ Path to the LOG file on disk.
69
+ data : JSONData
70
+ Data to write as LOG. Should be a list of dictionaries or a
71
+ single dictionary.
72
+
73
+ Returns
74
+ -------
75
+ int
76
+ The number of rows written to the LOG file.
77
+ """
78
+ return stub.write(path, data, format_name='LOG')
etlplus/file/mat.py ADDED
@@ -0,0 +1,78 @@
1
+ """
2
+ :mod:`etlplus.file.mat` module.
3
+
4
+ Helpers for reading/writing MATLAB (MAT) data files.
5
+
6
+ Notes
7
+ -----
8
+ - A MAT file is a binary file format used by MATLAB to store variables,
9
+ arrays, and other data structures.
10
+ - Common cases:
11
+ - Storing numerical arrays and matrices.
12
+ - Saving workspace variables.
13
+ - Sharing data between MATLAB and other programming environments.
14
+ - Rule of thumb:
15
+ - If the file follows the MAT-file specification, use this module for
16
+ reading and writing.
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pathlib import Path
22
+
23
+ from ..types import JSONData
24
+ from ..types import JSONList
25
+ from . import stub
26
+
27
+ # SECTION: EXPORTS ========================================================== #
28
+
29
+
30
+ __all__ = [
31
+ 'read',
32
+ 'write',
33
+ ]
34
+
35
+
36
+ # SECTION: FUNCTIONS ======================================================== #
37
+
38
+
39
+ def read(
40
+ path: Path,
41
+ ) -> JSONList:
42
+ """
43
+ Read MAT content from ``path``.
44
+
45
+ Parameters
46
+ ----------
47
+ path : Path
48
+ Path to the MAT file on disk.
49
+
50
+ Returns
51
+ -------
52
+ JSONList
53
+ The list of dictionaries read from the MAT file.
54
+ """
55
+ return stub.read(path, format_name='MAT')
56
+
57
+
58
+ def write(
59
+ path: Path,
60
+ data: JSONData,
61
+ ) -> int:
62
+ """
63
+ Write ``data`` to MAT file at ``path`` and return record count.
64
+
65
+ Parameters
66
+ ----------
67
+ path : Path
68
+ Path to the MAT file on disk.
69
+ data : JSONData
70
+ Data to write as MAT file. Should be a list of dictionaries or a
71
+ single dictionary.
72
+
73
+ Returns
74
+ -------
75
+ int
76
+ The number of rows written to the MAT file.
77
+ """
78
+ return stub.write(path, data, format_name='MAT')