etlplus 0.9.2__py3-none-any.whl → 0.10.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/__init__.py +26 -1
- etlplus/api/README.md +3 -51
- etlplus/api/__init__.py +0 -10
- etlplus/api/config.py +28 -39
- etlplus/api/endpoint_client.py +3 -3
- etlplus/api/pagination/client.py +1 -1
- etlplus/api/rate_limiting/config.py +1 -13
- etlplus/api/rate_limiting/rate_limiter.py +11 -8
- etlplus/api/request_manager.py +6 -11
- etlplus/api/transport.py +2 -14
- etlplus/api/types.py +6 -96
- etlplus/cli/commands.py +43 -76
- etlplus/cli/constants.py +1 -1
- etlplus/cli/handlers.py +12 -40
- etlplus/cli/io.py +2 -2
- etlplus/cli/main.py +1 -1
- etlplus/cli/state.py +7 -4
- etlplus/{workflow → config}/__init__.py +23 -10
- etlplus/{workflow → config}/connector.py +44 -58
- etlplus/{workflow → config}/jobs.py +32 -105
- etlplus/{workflow → config}/pipeline.py +51 -59
- etlplus/{workflow → config}/profile.py +5 -8
- etlplus/config/types.py +204 -0
- etlplus/config/utils.py +120 -0
- etlplus/database/ddl.py +1 -1
- etlplus/database/engine.py +3 -19
- etlplus/database/orm.py +0 -2
- etlplus/database/schema.py +1 -1
- etlplus/enums.py +288 -0
- etlplus/{ops/extract.py → extract.py} +99 -81
- etlplus/file.py +652 -0
- etlplus/{ops/load.py → load.py} +101 -78
- etlplus/{ops/run.py → run.py} +127 -159
- etlplus/{api/utils.py → run_helpers.py} +153 -209
- etlplus/{ops/transform.py → transform.py} +68 -75
- etlplus/types.py +4 -5
- etlplus/utils.py +2 -136
- etlplus/{ops/validate.py → validate.py} +12 -22
- etlplus/validation/__init__.py +44 -0
- etlplus/{ops → validation}/utils.py +17 -53
- {etlplus-0.9.2.dist-info → etlplus-0.10.2.dist-info}/METADATA +17 -210
- etlplus-0.10.2.dist-info/RECORD +65 -0
- {etlplus-0.9.2.dist-info → etlplus-0.10.2.dist-info}/WHEEL +1 -1
- etlplus/README.md +0 -37
- etlplus/api/enums.py +0 -51
- etlplus/cli/README.md +0 -40
- etlplus/database/README.md +0 -48
- etlplus/file/README.md +0 -105
- etlplus/file/__init__.py +0 -25
- etlplus/file/_imports.py +0 -141
- etlplus/file/_io.py +0 -160
- etlplus/file/accdb.py +0 -78
- etlplus/file/arrow.py +0 -78
- etlplus/file/avro.py +0 -176
- etlplus/file/bson.py +0 -77
- etlplus/file/cbor.py +0 -78
- etlplus/file/cfg.py +0 -79
- etlplus/file/conf.py +0 -80
- etlplus/file/core.py +0 -322
- etlplus/file/csv.py +0 -79
- etlplus/file/dat.py +0 -78
- etlplus/file/dta.py +0 -77
- etlplus/file/duckdb.py +0 -78
- etlplus/file/enums.py +0 -343
- etlplus/file/feather.py +0 -111
- etlplus/file/fwf.py +0 -77
- etlplus/file/gz.py +0 -123
- etlplus/file/hbs.py +0 -78
- etlplus/file/hdf5.py +0 -78
- etlplus/file/ini.py +0 -79
- etlplus/file/ion.py +0 -78
- etlplus/file/jinja2.py +0 -78
- etlplus/file/json.py +0 -98
- etlplus/file/log.py +0 -78
- etlplus/file/mat.py +0 -78
- etlplus/file/mdb.py +0 -78
- etlplus/file/msgpack.py +0 -78
- etlplus/file/mustache.py +0 -78
- etlplus/file/nc.py +0 -78
- etlplus/file/ndjson.py +0 -108
- etlplus/file/numbers.py +0 -75
- etlplus/file/ods.py +0 -79
- etlplus/file/orc.py +0 -111
- etlplus/file/parquet.py +0 -113
- etlplus/file/pb.py +0 -78
- etlplus/file/pbf.py +0 -77
- etlplus/file/properties.py +0 -78
- etlplus/file/proto.py +0 -77
- etlplus/file/psv.py +0 -79
- etlplus/file/rda.py +0 -78
- etlplus/file/rds.py +0 -78
- etlplus/file/sas7bdat.py +0 -78
- etlplus/file/sav.py +0 -77
- etlplus/file/sqlite.py +0 -78
- etlplus/file/stub.py +0 -84
- etlplus/file/sylk.py +0 -77
- etlplus/file/tab.py +0 -81
- etlplus/file/toml.py +0 -78
- etlplus/file/tsv.py +0 -80
- etlplus/file/txt.py +0 -102
- etlplus/file/vm.py +0 -78
- etlplus/file/wks.py +0 -77
- etlplus/file/xls.py +0 -88
- etlplus/file/xlsm.py +0 -79
- etlplus/file/xlsx.py +0 -99
- etlplus/file/xml.py +0 -185
- etlplus/file/xpt.py +0 -78
- etlplus/file/yaml.py +0 -95
- etlplus/file/zip.py +0 -175
- etlplus/file/zsav.py +0 -77
- etlplus/ops/README.md +0 -50
- etlplus/ops/__init__.py +0 -61
- etlplus/templates/README.md +0 -46
- etlplus/workflow/README.md +0 -52
- etlplus/workflow/dag.py +0 -105
- etlplus/workflow/types.py +0 -115
- etlplus-0.9.2.dist-info/RECORD +0 -134
- {etlplus-0.9.2.dist-info → etlplus-0.10.2.dist-info}/entry_points.txt +0 -0
- {etlplus-0.9.2.dist-info → etlplus-0.10.2.dist-info}/licenses/LICENSE +0 -0
- {etlplus-0.9.2.dist-info → etlplus-0.10.2.dist-info}/top_level.txt +0 -0
etlplus/file/rda.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.rda` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing RData workspace/object bundle (RDA) files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A RDA file is a binary file format used by R to store workspace objects,
|
|
9
|
-
including data frames, lists, and other R objects.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Storing R data objects for later use.
|
|
12
|
-
- Sharing R datasets between users.
|
|
13
|
-
- Loading R data into Python for analysis.
|
|
14
|
-
- Rule of thumb:
|
|
15
|
-
- If the file follows the RDA 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 RDA content from ``path``.
|
|
44
|
-
|
|
45
|
-
Parameters
|
|
46
|
-
----------
|
|
47
|
-
path : Path
|
|
48
|
-
Path to the RDA file on disk.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
JSONList
|
|
53
|
-
The list of dictionaries read from the RDA file.
|
|
54
|
-
"""
|
|
55
|
-
return stub.read(path, format_name='RDA')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def write(
|
|
59
|
-
path: Path,
|
|
60
|
-
data: JSONData,
|
|
61
|
-
) -> int:
|
|
62
|
-
"""
|
|
63
|
-
Write ``data`` to RDA file at ``path`` and return record count.
|
|
64
|
-
|
|
65
|
-
Parameters
|
|
66
|
-
----------
|
|
67
|
-
path : Path
|
|
68
|
-
Path to the RDA file on disk.
|
|
69
|
-
data : JSONData
|
|
70
|
-
Data to write as RDA 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 RDA file.
|
|
77
|
-
"""
|
|
78
|
-
return stub.write(path, data, format_name='RDA')
|
etlplus/file/rds.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.rds` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing R (RDS) data files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- An RDS file is a binary file format used by R to store a single R object,
|
|
9
|
-
such as a data frame, list, or vector.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Storing R objects for later use.
|
|
12
|
-
- Sharing R data between users.
|
|
13
|
-
- Loading R data into Python for analysis.
|
|
14
|
-
- Rule of thumb:
|
|
15
|
-
- If the file follows the RDS 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 RDS content from ``path``.
|
|
44
|
-
|
|
45
|
-
Parameters
|
|
46
|
-
----------
|
|
47
|
-
path : Path
|
|
48
|
-
Path to the RDS file on disk.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
JSONList
|
|
53
|
-
The list of dictionaries read from the RDS file.
|
|
54
|
-
"""
|
|
55
|
-
return stub.read(path, format_name='RDS')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def write(
|
|
59
|
-
path: Path,
|
|
60
|
-
data: JSONData,
|
|
61
|
-
) -> int:
|
|
62
|
-
"""
|
|
63
|
-
Write ``data`` to RDS file at ``path`` and return record count.
|
|
64
|
-
|
|
65
|
-
Parameters
|
|
66
|
-
----------
|
|
67
|
-
path : Path
|
|
68
|
-
Path to the RDS file on disk.
|
|
69
|
-
data : JSONData
|
|
70
|
-
Data to write as RDS 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 RDS file.
|
|
77
|
-
"""
|
|
78
|
-
return stub.write(path, data, format_name='RDS')
|
etlplus/file/sas7bdat.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.sas7bdat` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing SAS (SAS7BDAT) data files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A SAS7BDAT file is a binary file format used by SAS to store datasets,
|
|
9
|
-
including variables, labels, and data types.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Delimited text files (e.g., CSV, TSV).
|
|
12
|
-
- Fixed-width formatted files.
|
|
13
|
-
- Custom formats specific to certain applications.
|
|
14
|
-
- Rule of thumb:
|
|
15
|
-
- If the file does not follow a specific standard format, use this module
|
|
16
|
-
for 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 DAT content from ``path``.
|
|
44
|
-
|
|
45
|
-
Parameters
|
|
46
|
-
----------
|
|
47
|
-
path : Path
|
|
48
|
-
Path to the SAS7BDAT file on disk.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
JSONList
|
|
53
|
-
The list of dictionaries read from the SAS7BDAT file.
|
|
54
|
-
"""
|
|
55
|
-
return stub.read(path, format_name='SAS7BDAT')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def write(
|
|
59
|
-
path: Path,
|
|
60
|
-
data: JSONData,
|
|
61
|
-
) -> int:
|
|
62
|
-
"""
|
|
63
|
-
Write ``data`` to SAS7BDAT file at ``path`` and return record count.
|
|
64
|
-
|
|
65
|
-
Parameters
|
|
66
|
-
----------
|
|
67
|
-
path : Path
|
|
68
|
-
Path to the SAS7BDAT file on disk.
|
|
69
|
-
data : JSONData
|
|
70
|
-
Data to write as SAS7BDAT 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 SAS7BDAT file.
|
|
77
|
-
"""
|
|
78
|
-
return stub.write(path, data, format_name='SAS7BDAT')
|
etlplus/file/sav.py
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.sav` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing SPSS (SAV) data files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A SAV file is a binary file format used by SPSS to store datasets, including
|
|
9
|
-
variables, labels, and data types.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Reading data for analysis in Python.
|
|
12
|
-
- Writing processed data back to SPSS format.
|
|
13
|
-
- Rule of thumb:
|
|
14
|
-
- If you need to work with SPSS data files, use this module for reading
|
|
15
|
-
and writing.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
from __future__ import annotations
|
|
19
|
-
|
|
20
|
-
from pathlib import Path
|
|
21
|
-
|
|
22
|
-
from ..types import JSONData
|
|
23
|
-
from ..types import JSONList
|
|
24
|
-
from . import stub
|
|
25
|
-
|
|
26
|
-
# SECTION: EXPORTS ========================================================== #
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
__all__ = [
|
|
30
|
-
'read',
|
|
31
|
-
'write',
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# SECTION: FUNCTIONS ======================================================== #
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def read(
|
|
39
|
-
path: Path,
|
|
40
|
-
) -> JSONList:
|
|
41
|
-
"""
|
|
42
|
-
Read SAV content from ``path``.
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
path : Path
|
|
47
|
-
Path to the SAV file on disk.
|
|
48
|
-
|
|
49
|
-
Returns
|
|
50
|
-
-------
|
|
51
|
-
JSONList
|
|
52
|
-
The list of dictionaries read from the SAV file.
|
|
53
|
-
"""
|
|
54
|
-
return stub.read(path, format_name='SAV')
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def write(
|
|
58
|
-
path: Path,
|
|
59
|
-
data: JSONData,
|
|
60
|
-
) -> int:
|
|
61
|
-
"""
|
|
62
|
-
Write ``data`` to SAV file at ``path`` and return record count.
|
|
63
|
-
|
|
64
|
-
Parameters
|
|
65
|
-
----------
|
|
66
|
-
path : Path
|
|
67
|
-
Path to the SAV file on disk.
|
|
68
|
-
data : JSONData
|
|
69
|
-
Data to write as SAV file. Should be a list of dictionaries or a
|
|
70
|
-
single dictionary.
|
|
71
|
-
|
|
72
|
-
Returns
|
|
73
|
-
-------
|
|
74
|
-
int
|
|
75
|
-
The number of rows written to the SAV file.
|
|
76
|
-
"""
|
|
77
|
-
return stub.write(path, data, format_name='SAV')
|
etlplus/file/sqlite.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.sqlite` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing SQLite database (SQLITE) files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A SQLITE file is a self-contained, serverless database file format used by
|
|
9
|
-
SQLite.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Lightweight database applications.
|
|
12
|
-
- Embedded database solutions.
|
|
13
|
-
- Mobile and desktop applications requiring local data storage.
|
|
14
|
-
- Rule of thumb:
|
|
15
|
-
- If the file follows the SQLITE 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 SQLITE content from ``path``.
|
|
44
|
-
|
|
45
|
-
Parameters
|
|
46
|
-
----------
|
|
47
|
-
path : Path
|
|
48
|
-
Path to the SQLITE file on disk.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
JSONList
|
|
53
|
-
The list of dictionaries read from the SQLITE file.
|
|
54
|
-
"""
|
|
55
|
-
return stub.read(path, format_name='SQLITE')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def write(
|
|
59
|
-
path: Path,
|
|
60
|
-
data: JSONData,
|
|
61
|
-
) -> int:
|
|
62
|
-
"""
|
|
63
|
-
Write ``data`` to SQLITE at ``path`` and return record count.
|
|
64
|
-
|
|
65
|
-
Parameters
|
|
66
|
-
----------
|
|
67
|
-
path : Path
|
|
68
|
-
Path to the SQLITE file on disk.
|
|
69
|
-
data : JSONData
|
|
70
|
-
Data to write as SQLITE. 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 SQLITE file.
|
|
77
|
-
"""
|
|
78
|
-
return stub.write(path, data, format_name='SQLITE')
|
etlplus/file/stub.py
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.stub` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing stubbed files.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
|
-
from ..types import JSONData
|
|
12
|
-
from ..types import JSONList
|
|
13
|
-
|
|
14
|
-
# SECTION: EXPORTS ========================================================== #
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__all__ = [
|
|
18
|
-
'read',
|
|
19
|
-
'write',
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# SECTION: FUNCTIONS ======================================================== #
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def read(
|
|
27
|
-
path: Path,
|
|
28
|
-
format_name: str = 'Stubbed',
|
|
29
|
-
) -> JSONList:
|
|
30
|
-
"""
|
|
31
|
-
Raises a :class:`NotImplementedError` for stubbed reads.
|
|
32
|
-
|
|
33
|
-
Parameters
|
|
34
|
-
----------
|
|
35
|
-
path : Path
|
|
36
|
-
Path to the stubbed file on disk.
|
|
37
|
-
format_name : str
|
|
38
|
-
Human-readable format name.
|
|
39
|
-
|
|
40
|
-
Returns
|
|
41
|
-
-------
|
|
42
|
-
JSONList
|
|
43
|
-
The list of dictionaries read from the stubbed file.
|
|
44
|
-
|
|
45
|
-
Raises
|
|
46
|
-
------
|
|
47
|
-
NotImplementedError
|
|
48
|
-
Always, since this is a stub implementation.
|
|
49
|
-
"""
|
|
50
|
-
_ = path
|
|
51
|
-
raise NotImplementedError(f'{format_name} read is not implemented yet')
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def write(
|
|
55
|
-
path: Path,
|
|
56
|
-
data: JSONData,
|
|
57
|
-
format_name: str = 'Stubbed',
|
|
58
|
-
) -> int:
|
|
59
|
-
"""
|
|
60
|
-
Raises a :class:`NotImplementedError` for stubbed writes.
|
|
61
|
-
|
|
62
|
-
Parameters
|
|
63
|
-
----------
|
|
64
|
-
path : Path
|
|
65
|
-
Path to the stubbed file on disk.
|
|
66
|
-
data : JSONData
|
|
67
|
-
Data to write as stubbed file. Should be a list of dictionaries or a
|
|
68
|
-
single dictionary.
|
|
69
|
-
format_name : str
|
|
70
|
-
Human-readable format name.
|
|
71
|
-
|
|
72
|
-
Returns
|
|
73
|
-
-------
|
|
74
|
-
int
|
|
75
|
-
The number of rows written to the stubbed file.
|
|
76
|
-
|
|
77
|
-
Raises
|
|
78
|
-
------
|
|
79
|
-
NotImplementedError
|
|
80
|
-
Always, since this is a stub implementation.
|
|
81
|
-
"""
|
|
82
|
-
_ = path
|
|
83
|
-
_ = data
|
|
84
|
-
raise NotImplementedError(f'{format_name} write is not implemented yet')
|
etlplus/file/sylk.py
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.sylk` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing Symbolic Link (SYLK) data files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A SYLK file is a text-based file format used to represent spreadsheet
|
|
9
|
-
data, including cell values, formulas, and formatting.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Storing spreadsheet data in a human-readable format.
|
|
12
|
-
- Exchanging data between different spreadsheet applications.
|
|
13
|
-
- Rule of thumb:
|
|
14
|
-
- If you need to work with SYLK files, use this module for reading
|
|
15
|
-
and writing.
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
from __future__ import annotations
|
|
19
|
-
|
|
20
|
-
from pathlib import Path
|
|
21
|
-
|
|
22
|
-
from ..types import JSONData
|
|
23
|
-
from ..types import JSONList
|
|
24
|
-
from . import stub
|
|
25
|
-
|
|
26
|
-
# SECTION: EXPORTS ========================================================== #
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
__all__ = [
|
|
30
|
-
'read',
|
|
31
|
-
'write',
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# SECTION: FUNCTIONS ======================================================== #
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def read(
|
|
39
|
-
path: Path,
|
|
40
|
-
) -> JSONList:
|
|
41
|
-
"""
|
|
42
|
-
Read SYLK content from ``path``.
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
path : Path
|
|
47
|
-
Path to the SYLK file on disk.
|
|
48
|
-
|
|
49
|
-
Returns
|
|
50
|
-
-------
|
|
51
|
-
JSONList
|
|
52
|
-
The list of dictionaries read from the SYLK file.
|
|
53
|
-
"""
|
|
54
|
-
return stub.read(path, format_name='SYLK')
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def write(
|
|
58
|
-
path: Path,
|
|
59
|
-
data: JSONData,
|
|
60
|
-
) -> int:
|
|
61
|
-
"""
|
|
62
|
-
Write ``data`` to SYLK file at ``path`` and return record count.
|
|
63
|
-
|
|
64
|
-
Parameters
|
|
65
|
-
----------
|
|
66
|
-
path : Path
|
|
67
|
-
Path to the SYLK file on disk.
|
|
68
|
-
data : JSONData
|
|
69
|
-
Data to write as SYLK file. Should be a list of dictionaries or a
|
|
70
|
-
single dictionary.
|
|
71
|
-
|
|
72
|
-
Returns
|
|
73
|
-
-------
|
|
74
|
-
int
|
|
75
|
-
The number of rows written to the SYLK file.
|
|
76
|
-
"""
|
|
77
|
-
return stub.write(path, data, format_name='SYLK')
|
etlplus/file/tab.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.tab` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing "tab"-formatted (TAB) files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A TAB file is not necessarily a TSV file when tabs aren’t actually the
|
|
9
|
-
delimiter that defines the fields, even if the text looks column-aligned.
|
|
10
|
-
- Common cases:
|
|
11
|
-
- Fixed-width text (FWF) that uses tabs for alignment.
|
|
12
|
-
- Mixed whitespace (tabs + spaces) as “pretty printing”.
|
|
13
|
-
- Tabs embedded inside quoted fields (or unescaped tabs in free text).
|
|
14
|
-
- Header/metadata lines or multi-line records that break TSV assumptions.
|
|
15
|
-
- Not actually tab-delimited despite the name.
|
|
16
|
-
- Rule of thumb:
|
|
17
|
-
- If the file is truly tab-delimited, use :mod:`etlplus.file.tsv`.
|
|
18
|
-
- If the file has fixed-width fields, use :mod:`etlplus.file.fwf`.
|
|
19
|
-
- Otherwise, use :mod:`etlplus.file.tab` (i.e., this module).
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
from __future__ import annotations
|
|
23
|
-
|
|
24
|
-
from pathlib import Path
|
|
25
|
-
|
|
26
|
-
from ..types import JSONData
|
|
27
|
-
from ..types import JSONList
|
|
28
|
-
from . import stub
|
|
29
|
-
|
|
30
|
-
# SECTION: EXPORTS ========================================================== #
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
__all__ = [
|
|
34
|
-
'read',
|
|
35
|
-
'write',
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# SECTION: FUNCTIONS ======================================================== #
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def read(
|
|
43
|
-
path: Path,
|
|
44
|
-
) -> JSONList:
|
|
45
|
-
"""
|
|
46
|
-
Read TAB content from ``path``.
|
|
47
|
-
|
|
48
|
-
Parameters
|
|
49
|
-
----------
|
|
50
|
-
path : Path
|
|
51
|
-
Path to the TAB file on disk.
|
|
52
|
-
|
|
53
|
-
Returns
|
|
54
|
-
-------
|
|
55
|
-
JSONList
|
|
56
|
-
The list of dictionaries read from the TAB file.
|
|
57
|
-
"""
|
|
58
|
-
return stub.read(path, format_name='TAB')
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def write(
|
|
62
|
-
path: Path,
|
|
63
|
-
data: JSONData,
|
|
64
|
-
) -> int:
|
|
65
|
-
"""
|
|
66
|
-
Write ``data`` to TAB file at ``path`` and return record count.
|
|
67
|
-
|
|
68
|
-
Parameters
|
|
69
|
-
----------
|
|
70
|
-
path : Path
|
|
71
|
-
Path to the TAB file on disk.
|
|
72
|
-
data : JSONData
|
|
73
|
-
Data to write as TAB file. Should be a list of dictionaries or a
|
|
74
|
-
single dictionary.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
int
|
|
79
|
-
The number of rows written to the TAB file.
|
|
80
|
-
"""
|
|
81
|
-
return stub.write(path, data, format_name='TAB')
|
etlplus/file/toml.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
:mod:`etlplus.file.toml` module.
|
|
3
|
-
|
|
4
|
-
Helpers for reading/writing Tom's Obvious Minimal Language (TOML) files.
|
|
5
|
-
|
|
6
|
-
Notes
|
|
7
|
-
-----
|
|
8
|
-
- A TOML file is a configuration file that uses the TOML syntax.
|
|
9
|
-
- Common cases:
|
|
10
|
-
- Simple key-value pairs.
|
|
11
|
-
- Nested tables and arrays.
|
|
12
|
-
- Data types such as strings, integers, floats, booleans, dates, and
|
|
13
|
-
arrays.
|
|
14
|
-
- Rule of thumb:
|
|
15
|
-
- If the file follows the TOML 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 TOML content from ``path``.
|
|
44
|
-
|
|
45
|
-
Parameters
|
|
46
|
-
----------
|
|
47
|
-
path : Path
|
|
48
|
-
Path to the TOML file on disk.
|
|
49
|
-
|
|
50
|
-
Returns
|
|
51
|
-
-------
|
|
52
|
-
JSONList
|
|
53
|
-
The list of dictionaries read from the TOML file.
|
|
54
|
-
"""
|
|
55
|
-
return stub.read(path, format_name='TOML')
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def write(
|
|
59
|
-
path: Path,
|
|
60
|
-
data: JSONData,
|
|
61
|
-
) -> int:
|
|
62
|
-
"""
|
|
63
|
-
Write ``data`` to TOML at ``path`` and return record count.
|
|
64
|
-
|
|
65
|
-
Parameters
|
|
66
|
-
----------
|
|
67
|
-
path : Path
|
|
68
|
-
Path to the TOML file on disk.
|
|
69
|
-
data : JSONData
|
|
70
|
-
Data to write as TOML. 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 TOML file.
|
|
77
|
-
"""
|
|
78
|
-
return stub.write(path, data, format_name='TOML')
|