etlplus 0.12.10__py3-none-any.whl → 0.14.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/README.md +1 -1
- etlplus/__init__.py +1 -26
- etlplus/api/__init__.py +10 -0
- etlplus/api/config.py +36 -20
- etlplus/api/endpoint_client.py +3 -3
- etlplus/api/enums.py +51 -0
- etlplus/api/pagination/client.py +1 -1
- etlplus/api/rate_limiting/config.py +13 -1
- etlplus/api/rate_limiting/rate_limiter.py +8 -11
- etlplus/api/request_manager.py +11 -6
- etlplus/api/transport.py +14 -2
- etlplus/api/types.py +7 -6
- etlplus/{run_helpers.py → api/utils.py} +205 -153
- etlplus/cli/handlers.py +17 -7
- etlplus/config/jobs.py +14 -4
- etlplus/dag.py +103 -0
- etlplus/enums.py +0 -32
- etlplus/file/cfg.py +2 -2
- etlplus/file/conf.py +2 -2
- etlplus/file/dta.py +77 -0
- etlplus/file/enums.py +10 -4
- etlplus/file/hbs.py +78 -0
- etlplus/file/hdf5.py +78 -0
- etlplus/file/jinja2.py +78 -0
- etlplus/file/mat.py +78 -0
- etlplus/file/mustache.py +78 -0
- etlplus/file/nc.py +78 -0
- etlplus/file/numbers.py +75 -0
- etlplus/file/ods.py +79 -0
- etlplus/file/properties.py +13 -13
- etlplus/file/rda.py +78 -0
- etlplus/file/rds.py +78 -0
- etlplus/file/sas7bdat.py +78 -0
- etlplus/file/sav.py +77 -0
- etlplus/file/sylk.py +77 -0
- etlplus/file/toml.py +1 -1
- etlplus/file/vm.py +78 -0
- etlplus/file/wks.py +77 -0
- etlplus/file/xlsm.py +79 -0
- etlplus/file/xpt.py +78 -0
- etlplus/file/zsav.py +77 -0
- etlplus/{validation → ops}/README.md +2 -2
- etlplus/ops/__init__.py +61 -0
- etlplus/{extract.py → ops/extract.py} +78 -94
- etlplus/{load.py → ops/load.py} +73 -93
- etlplus/{run.py → ops/run.py} +140 -110
- etlplus/{transform.py → ops/transform.py} +75 -68
- etlplus/{validation → ops}/utils.py +80 -15
- etlplus/{validate.py → ops/validate.py} +19 -9
- etlplus/types.py +2 -2
- {etlplus-0.12.10.dist-info → etlplus-0.14.3.dist-info}/METADATA +91 -60
- {etlplus-0.12.10.dist-info → etlplus-0.14.3.dist-info}/RECORD +56 -35
- etlplus/validation/__init__.py +0 -44
- {etlplus-0.12.10.dist-info → etlplus-0.14.3.dist-info}/WHEEL +0 -0
- {etlplus-0.12.10.dist-info → etlplus-0.14.3.dist-info}/entry_points.txt +0 -0
- {etlplus-0.12.10.dist-info → etlplus-0.14.3.dist-info}/licenses/LICENSE +0 -0
- {etlplus-0.12.10.dist-info → etlplus-0.14.3.dist-info}/top_level.txt +0 -0
etlplus/file/nc.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.nc` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing NetCDF (NC) data files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A NC file is a binary file format used for array-oriented scientific data,
|
|
9
|
+
particularly in meteorology, oceanography, and climate science.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- Storing multi-dimensional scientific data.
|
|
12
|
+
- Sharing large datasets in research communities.
|
|
13
|
+
- Efficient data access and manipulation.
|
|
14
|
+
- Rule of thumb:
|
|
15
|
+
- If the file follows the NetCDF standard, 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 NC content from ``path``.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
path : Path
|
|
48
|
+
Path to the NC file on disk.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
JSONList
|
|
53
|
+
The list of dictionaries read from the NC file.
|
|
54
|
+
"""
|
|
55
|
+
return stub.read(path, format_name='NC')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write(
|
|
59
|
+
path: Path,
|
|
60
|
+
data: JSONData,
|
|
61
|
+
) -> int:
|
|
62
|
+
"""
|
|
63
|
+
Write ``data`` to NC file at ``path`` and return record count.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
path : Path
|
|
68
|
+
Path to the NC file on disk.
|
|
69
|
+
data : JSONData
|
|
70
|
+
Data to write as NC 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 NC file.
|
|
77
|
+
"""
|
|
78
|
+
return stub.write(path, data, format_name='NC')
|
etlplus/file/numbers.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.numbers` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing Apple Numbers (NUMBERS) spreadsheet files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A NUMBERS file is a spreadsheet file created by Apple Numbers.
|
|
9
|
+
- Common cases:
|
|
10
|
+
- Spreadsheet files created by Apple Numbers.
|
|
11
|
+
- Rule of thumb:
|
|
12
|
+
- If you need to read/write NUMBERS files, consider converting them to
|
|
13
|
+
more common formats like CSV or XLSX for better compatibility.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
from ..types import JSONData
|
|
21
|
+
from ..types import JSONList
|
|
22
|
+
from . import stub
|
|
23
|
+
|
|
24
|
+
# SECTION: EXPORTS ========================================================== #
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
'read',
|
|
29
|
+
'write',
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def read(
|
|
37
|
+
path: Path,
|
|
38
|
+
) -> JSONList:
|
|
39
|
+
"""
|
|
40
|
+
Read NUMBERS content from ``path``.
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
path : Path
|
|
45
|
+
Path to the NUMBERS file on disk.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
JSONList
|
|
50
|
+
The list of dictionaries read from the NUMBERS file.
|
|
51
|
+
"""
|
|
52
|
+
return stub.read(path, format_name='NUMBERS')
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def write(
|
|
56
|
+
path: Path,
|
|
57
|
+
data: JSONData,
|
|
58
|
+
) -> int:
|
|
59
|
+
"""
|
|
60
|
+
Write ``data`` to NUMBERS file at ``path`` and return record count.
|
|
61
|
+
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
path : Path
|
|
65
|
+
Path to the NUMBERS file on disk.
|
|
66
|
+
data : JSONData
|
|
67
|
+
Data to write as NUMBERS file. Should be a list of dictionaries or a
|
|
68
|
+
single dictionary.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
int
|
|
73
|
+
The number of rows written to the NUMBERS file.
|
|
74
|
+
"""
|
|
75
|
+
return stub.write(path, data, format_name='NUMBERS')
|
etlplus/file/ods.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.ods` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing OpenDocument (ODS) spreadsheet files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- An ODS file is a spreadsheet file created using the OpenDocument format.
|
|
9
|
+
- Common cases:
|
|
10
|
+
- Spreadsheet files created by LibreOffice Calc, Apache OpenOffice Calc, or
|
|
11
|
+
other applications that support the OpenDocument format.
|
|
12
|
+
- Spreadsheet files exchanged in open standards environments.
|
|
13
|
+
- Spreadsheet files used in government or educational institutions
|
|
14
|
+
promoting open formats.
|
|
15
|
+
- Rule of thumb:
|
|
16
|
+
- If the file follows the OpenDocument 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 ODS content from ``path``.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
path : Path
|
|
49
|
+
Path to the ODS file on disk.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
JSONList
|
|
54
|
+
The list of dictionaries read from the ODS file.
|
|
55
|
+
"""
|
|
56
|
+
return stub.read(path, format_name='ODS')
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def write(
|
|
60
|
+
path: Path,
|
|
61
|
+
data: JSONData,
|
|
62
|
+
) -> int:
|
|
63
|
+
"""
|
|
64
|
+
Write ``data`` to ODS file at ``path`` and return record count.
|
|
65
|
+
|
|
66
|
+
Parameters
|
|
67
|
+
----------
|
|
68
|
+
path : Path
|
|
69
|
+
Path to the ODS file on disk.
|
|
70
|
+
data : JSONData
|
|
71
|
+
Data to write as ODS file. 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 ODS file.
|
|
78
|
+
"""
|
|
79
|
+
return stub.write(path, data, format_name='ODS')
|
etlplus/file/properties.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
|
-
:mod:`etlplus.file.
|
|
2
|
+
:mod:`etlplus.file.properties` module.
|
|
3
3
|
|
|
4
|
-
Helpers for reading/writing properties (
|
|
4
|
+
Helpers for reading/writing properties (PROPERTIES) files.
|
|
5
5
|
|
|
6
6
|
Notes
|
|
7
7
|
-----
|
|
8
|
-
- A
|
|
9
|
-
|
|
8
|
+
- A PROPERTIES file is a properties file that typically uses key-value pairs,
|
|
9
|
+
often with a simple syntax.
|
|
10
10
|
- Common cases:
|
|
11
11
|
- Java-style properties files with ``key=value`` pairs.
|
|
12
12
|
- INI-style files without sections.
|
|
@@ -40,19 +40,19 @@ def read(
|
|
|
40
40
|
path: Path,
|
|
41
41
|
) -> JSONList:
|
|
42
42
|
"""
|
|
43
|
-
Read
|
|
43
|
+
Read PROPERTIES content from ``path``.
|
|
44
44
|
|
|
45
45
|
Parameters
|
|
46
46
|
----------
|
|
47
47
|
path : Path
|
|
48
|
-
Path to the
|
|
48
|
+
Path to the PROPERTIES file on disk.
|
|
49
49
|
|
|
50
50
|
Returns
|
|
51
51
|
-------
|
|
52
52
|
JSONList
|
|
53
|
-
The list of dictionaries read from the
|
|
53
|
+
The list of dictionaries read from the PROPERTIES file.
|
|
54
54
|
"""
|
|
55
|
-
return stub.read(path, format_name='
|
|
55
|
+
return stub.read(path, format_name='PROPERTIES')
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
def write(
|
|
@@ -60,19 +60,19 @@ def write(
|
|
|
60
60
|
data: JSONData,
|
|
61
61
|
) -> int:
|
|
62
62
|
"""
|
|
63
|
-
Write ``data`` to
|
|
63
|
+
Write ``data`` to PROPERTIES at ``path`` and return record count.
|
|
64
64
|
|
|
65
65
|
Parameters
|
|
66
66
|
----------
|
|
67
67
|
path : Path
|
|
68
|
-
Path to the
|
|
68
|
+
Path to the PROPERTIES file on disk.
|
|
69
69
|
data : JSONData
|
|
70
|
-
Data to write as
|
|
70
|
+
Data to write as PROPERTIES. Should be a list of dictionaries or a
|
|
71
71
|
single dictionary.
|
|
72
72
|
|
|
73
73
|
Returns
|
|
74
74
|
-------
|
|
75
75
|
int
|
|
76
|
-
The number of rows written to the
|
|
76
|
+
The number of rows written to the PROPERTIES file.
|
|
77
77
|
"""
|
|
78
|
-
return stub.write(path, data, format_name='
|
|
78
|
+
return stub.write(path, data, format_name='PROPERTIES')
|
etlplus/file/rda.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
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/sylk.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
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/toml.py
CHANGED
|
@@ -5,7 +5,7 @@ Helpers for reading/writing Tom's Obvious Minimal Language (TOML) files.
|
|
|
5
5
|
|
|
6
6
|
Notes
|
|
7
7
|
-----
|
|
8
|
-
- A
|
|
8
|
+
- A TOML file is a configuration file that uses the TOML syntax.
|
|
9
9
|
- Common cases:
|
|
10
10
|
- Simple key-value pairs.
|
|
11
11
|
- Nested tables and arrays.
|