etlplus 0.15.0__py3-none-any.whl → 0.16.6__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 +25 -3
- etlplus/__init__.py +2 -0
- etlplus/api/README.md +31 -0
- etlplus/api/__init__.py +14 -14
- etlplus/api/auth.py +10 -7
- etlplus/api/config.py +8 -13
- etlplus/api/endpoint_client.py +20 -20
- etlplus/api/errors.py +4 -4
- etlplus/api/pagination/__init__.py +6 -6
- etlplus/api/pagination/config.py +12 -10
- etlplus/api/pagination/paginator.py +6 -7
- etlplus/api/rate_limiting/__init__.py +2 -2
- etlplus/api/rate_limiting/config.py +14 -14
- etlplus/api/rate_limiting/rate_limiter.py +3 -3
- etlplus/api/request_manager.py +4 -4
- etlplus/api/retry_manager.py +8 -8
- etlplus/api/transport.py +11 -11
- etlplus/api/types.py +131 -11
- etlplus/api/utils.py +50 -50
- etlplus/cli/commands.py +93 -60
- etlplus/cli/constants.py +1 -1
- etlplus/cli/handlers.py +43 -26
- etlplus/cli/io.py +2 -2
- etlplus/cli/main.py +2 -2
- etlplus/cli/state.py +4 -7
- etlplus/{workflow/pipeline.py → config.py} +62 -99
- etlplus/connector/__init__.py +43 -0
- etlplus/connector/api.py +161 -0
- etlplus/connector/connector.py +26 -0
- etlplus/connector/core.py +132 -0
- etlplus/connector/database.py +122 -0
- etlplus/connector/enums.py +52 -0
- etlplus/connector/file.py +120 -0
- etlplus/connector/types.py +40 -0
- etlplus/connector/utils.py +122 -0
- etlplus/database/ddl.py +2 -2
- etlplus/database/engine.py +19 -3
- etlplus/database/orm.py +2 -0
- etlplus/enums.py +36 -200
- etlplus/file/_imports.py +1 -0
- etlplus/file/_io.py +52 -4
- etlplus/file/accdb.py +3 -2
- etlplus/file/arrow.py +3 -2
- etlplus/file/avro.py +3 -2
- etlplus/file/bson.py +3 -2
- etlplus/file/cbor.py +3 -2
- etlplus/file/cfg.py +3 -2
- etlplus/file/conf.py +3 -2
- etlplus/file/core.py +11 -8
- etlplus/file/csv.py +3 -2
- etlplus/file/dat.py +3 -2
- etlplus/file/dta.py +3 -2
- etlplus/file/duckdb.py +3 -2
- etlplus/file/enums.py +1 -1
- etlplus/file/feather.py +3 -2
- etlplus/file/fwf.py +3 -2
- etlplus/file/gz.py +3 -2
- etlplus/file/hbs.py +3 -2
- etlplus/file/hdf5.py +3 -2
- etlplus/file/ini.py +3 -2
- etlplus/file/ion.py +3 -2
- etlplus/file/jinja2.py +3 -2
- etlplus/file/json.py +5 -16
- etlplus/file/log.py +3 -2
- etlplus/file/mat.py +3 -2
- etlplus/file/mdb.py +3 -2
- etlplus/file/msgpack.py +3 -2
- etlplus/file/mustache.py +3 -2
- etlplus/file/nc.py +3 -2
- etlplus/file/ndjson.py +3 -2
- etlplus/file/numbers.py +3 -2
- etlplus/file/ods.py +3 -2
- etlplus/file/orc.py +3 -2
- etlplus/file/parquet.py +3 -2
- etlplus/file/pb.py +3 -2
- etlplus/file/pbf.py +3 -2
- etlplus/file/properties.py +3 -2
- etlplus/file/proto.py +3 -2
- etlplus/file/psv.py +3 -2
- etlplus/file/rda.py +3 -2
- etlplus/file/rds.py +3 -2
- etlplus/file/sas7bdat.py +3 -2
- etlplus/file/sav.py +3 -2
- etlplus/file/sqlite.py +3 -2
- etlplus/file/stub.py +1 -0
- etlplus/file/sylk.py +3 -2
- etlplus/file/tab.py +3 -2
- etlplus/file/toml.py +3 -2
- etlplus/file/tsv.py +3 -2
- etlplus/file/txt.py +4 -3
- etlplus/file/vm.py +3 -2
- etlplus/file/wks.py +3 -2
- etlplus/file/xls.py +3 -2
- etlplus/file/xlsm.py +3 -2
- etlplus/file/xlsx.py +3 -2
- etlplus/file/xml.py +9 -3
- etlplus/file/xpt.py +3 -2
- etlplus/file/yaml.py +5 -16
- etlplus/file/zip.py +3 -2
- etlplus/file/zsav.py +3 -2
- etlplus/ops/__init__.py +1 -0
- etlplus/ops/enums.py +173 -0
- etlplus/ops/extract.py +222 -23
- etlplus/ops/load.py +155 -36
- etlplus/ops/run.py +92 -107
- etlplus/ops/transform.py +48 -29
- etlplus/ops/types.py +147 -0
- etlplus/ops/utils.py +11 -40
- etlplus/ops/validate.py +16 -16
- etlplus/types.py +6 -102
- etlplus/utils.py +163 -29
- etlplus/workflow/README.md +0 -24
- etlplus/workflow/__init__.py +2 -15
- etlplus/workflow/dag.py +23 -1
- etlplus/workflow/jobs.py +83 -39
- etlplus/workflow/profile.py +4 -2
- {etlplus-0.15.0.dist-info → etlplus-0.16.6.dist-info}/METADATA +4 -4
- etlplus-0.16.6.dist-info/RECORD +143 -0
- {etlplus-0.15.0.dist-info → etlplus-0.16.6.dist-info}/WHEEL +1 -1
- etlplus/config/README.md +0 -50
- etlplus/config/__init__.py +0 -33
- etlplus/config/types.py +0 -140
- etlplus/dag.py +0 -103
- etlplus/workflow/connector.py +0 -373
- etlplus/workflow/types.py +0 -115
- etlplus/workflow/utils.py +0 -120
- etlplus-0.15.0.dist-info/RECORD +0 -139
- {etlplus-0.15.0.dist-info → etlplus-0.16.6.dist-info}/entry_points.txt +0 -0
- {etlplus-0.15.0.dist-info → etlplus-0.16.6.dist-info}/licenses/LICENSE +0 -0
- {etlplus-0.15.0.dist-info → etlplus-0.16.6.dist-info}/top_level.txt +0 -0
etlplus/api/utils.py
CHANGED
|
@@ -22,11 +22,11 @@ from .config import EndpointConfig
|
|
|
22
22
|
from .endpoint_client import EndpointClient
|
|
23
23
|
from .enums import HttpMethod
|
|
24
24
|
from .pagination import PaginationConfig
|
|
25
|
-
from .pagination import
|
|
25
|
+
from .pagination import PaginationConfigDict
|
|
26
26
|
from .rate_limiting import RateLimitConfig
|
|
27
|
-
from .rate_limiting import
|
|
27
|
+
from .rate_limiting import RateLimitConfigDict
|
|
28
28
|
from .rate_limiting import RateLimiter
|
|
29
|
-
from .retry_manager import
|
|
29
|
+
from .retry_manager import RetryPolicyDict
|
|
30
30
|
from .types import Headers
|
|
31
31
|
from .types import Params
|
|
32
32
|
from .types import Url
|
|
@@ -53,16 +53,16 @@ __all__ = [
|
|
|
53
53
|
'paginate_with_client',
|
|
54
54
|
'resolve_request',
|
|
55
55
|
# Typed Dicts
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
56
|
+
'ApiRequestEnvDict',
|
|
57
|
+
'ApiTargetEnvDict',
|
|
58
|
+
'SessionConfigDict',
|
|
59
59
|
]
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# SECTION: TYPED DICTS ====================================================== #
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
class
|
|
65
|
+
class BaseApiHttpEnvDict(TypedDict, total=False):
|
|
66
66
|
"""
|
|
67
67
|
Common HTTP request environment for API interactions.
|
|
68
68
|
|
|
@@ -78,7 +78,7 @@ class BaseApiHttpEnv(TypedDict, total=False):
|
|
|
78
78
|
session: requests.Session | None
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
class
|
|
81
|
+
class ApiRequestEnvDict(BaseApiHttpEnvDict, total=False):
|
|
82
82
|
"""
|
|
83
83
|
Composed HTTP request environment configuration for REST API sources.
|
|
84
84
|
|
|
@@ -96,15 +96,15 @@ class ApiRequestEnv(BaseApiHttpEnv, total=False):
|
|
|
96
96
|
|
|
97
97
|
# Request
|
|
98
98
|
params: dict[str, Any]
|
|
99
|
-
pagination:
|
|
99
|
+
pagination: PaginationConfigDict | None
|
|
100
100
|
sleep_seconds: float
|
|
101
101
|
|
|
102
102
|
# Reliability
|
|
103
|
-
retry:
|
|
103
|
+
retry: RetryPolicyDict | None
|
|
104
104
|
retry_network_errors: bool
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
class
|
|
107
|
+
class ApiTargetEnvDict(BaseApiHttpEnvDict, total=False):
|
|
108
108
|
"""
|
|
109
109
|
Composed HTTP request environment configuration for REST API targets.
|
|
110
110
|
|
|
@@ -126,7 +126,7 @@ class ApiTargetEnv(BaseApiHttpEnv, total=False):
|
|
|
126
126
|
method: str | None
|
|
127
127
|
|
|
128
128
|
|
|
129
|
-
class
|
|
129
|
+
class SessionConfigDict(TypedDict, total=False):
|
|
130
130
|
"""
|
|
131
131
|
Minimal session configuration schema accepted by the
|
|
132
132
|
:class:`requests.Session` runner.
|
|
@@ -148,14 +148,14 @@ class SessionConfig(TypedDict, total=False):
|
|
|
148
148
|
|
|
149
149
|
|
|
150
150
|
def _build_session_optional(
|
|
151
|
-
cfg:
|
|
151
|
+
cfg: SessionConfigDict | None,
|
|
152
152
|
) -> requests.Session | None:
|
|
153
153
|
"""
|
|
154
154
|
Return a configured session when *cfg* is a mapping.
|
|
155
155
|
|
|
156
156
|
Parameters
|
|
157
157
|
----------
|
|
158
|
-
cfg :
|
|
158
|
+
cfg : SessionConfigDict | None
|
|
159
159
|
Session configuration mapping.
|
|
160
160
|
|
|
161
161
|
Returns
|
|
@@ -164,7 +164,7 @@ def _build_session_optional(
|
|
|
164
164
|
Configured session or ``None``.
|
|
165
165
|
"""
|
|
166
166
|
if isinstance(cfg, Mapping):
|
|
167
|
-
return build_session(cast(
|
|
167
|
+
return build_session(cast(SessionConfigDict, cfg))
|
|
168
168
|
return None
|
|
169
169
|
|
|
170
170
|
|
|
@@ -172,7 +172,7 @@ def _coalesce(
|
|
|
172
172
|
*args: Any,
|
|
173
173
|
) -> Any | None:
|
|
174
174
|
"""
|
|
175
|
-
Return the first non-``None`` value from
|
|
175
|
+
Return the first non-``None`` value from *args*.
|
|
176
176
|
|
|
177
177
|
Parameters
|
|
178
178
|
----------
|
|
@@ -233,9 +233,9 @@ def _inherit_http_from_api_endpoint(
|
|
|
233
233
|
ep: EndpointConfig,
|
|
234
234
|
url: Url | None,
|
|
235
235
|
headers: dict[str, str],
|
|
236
|
-
session_cfg:
|
|
236
|
+
session_cfg: SessionConfigDict | None,
|
|
237
237
|
force_url: bool = False,
|
|
238
|
-
) -> tuple[Url | None, dict[str, str],
|
|
238
|
+
) -> tuple[Url | None, dict[str, str], SessionConfigDict | None]:
|
|
239
239
|
"""
|
|
240
240
|
Return HTTP settings inherited from API + endpoint definitions.
|
|
241
241
|
|
|
@@ -249,14 +249,14 @@ def _inherit_http_from_api_endpoint(
|
|
|
249
249
|
Existing URL to use when not forcing endpoint URL.
|
|
250
250
|
headers : dict[str, str]
|
|
251
251
|
Existing headers to augment.
|
|
252
|
-
session_cfg :
|
|
252
|
+
session_cfg : SessionConfigDict | None
|
|
253
253
|
Existing session configuration to augment.
|
|
254
254
|
force_url : bool, optional
|
|
255
255
|
Whether to always use the endpoint URL.
|
|
256
256
|
|
|
257
257
|
Returns
|
|
258
258
|
-------
|
|
259
|
-
tuple[Url | None, dict[str, str],
|
|
259
|
+
tuple[Url | None, dict[str, str], SessionConfigDict | None]
|
|
260
260
|
Resolved URL, headers, and session configuration.
|
|
261
261
|
"""
|
|
262
262
|
if force_url or not url:
|
|
@@ -269,8 +269,8 @@ def _inherit_http_from_api_endpoint(
|
|
|
269
269
|
def _merge_session_cfg_three(
|
|
270
270
|
api_cfg: ApiConfig,
|
|
271
271
|
ep: EndpointConfig,
|
|
272
|
-
source_session_cfg:
|
|
273
|
-
) ->
|
|
272
|
+
source_session_cfg: SessionConfigDict | None,
|
|
273
|
+
) -> SessionConfigDict | None:
|
|
274
274
|
"""
|
|
275
275
|
Merge session configurations from API, endpoint, and source.
|
|
276
276
|
|
|
@@ -280,12 +280,12 @@ def _merge_session_cfg_three(
|
|
|
280
280
|
API configuration.
|
|
281
281
|
ep : EndpointConfig
|
|
282
282
|
Endpoint configuration.
|
|
283
|
-
source_session_cfg :
|
|
283
|
+
source_session_cfg : SessionConfigDict | None
|
|
284
284
|
Source session configuration.
|
|
285
285
|
|
|
286
286
|
Returns
|
|
287
287
|
-------
|
|
288
|
-
|
|
288
|
+
SessionConfigDict | None
|
|
289
289
|
Merged session configuration.
|
|
290
290
|
"""
|
|
291
291
|
api_sess = getattr(api_cfg, 'session', None)
|
|
@@ -297,7 +297,7 @@ def _merge_session_cfg_three(
|
|
|
297
297
|
merged.update(ep_sess)
|
|
298
298
|
if isinstance(source_session_cfg, Mapping):
|
|
299
299
|
merged.update(source_session_cfg)
|
|
300
|
-
return cast(
|
|
300
|
+
return cast(SessionConfigDict | None, (merged or None))
|
|
301
301
|
|
|
302
302
|
|
|
303
303
|
def _update_mapping(
|
|
@@ -361,7 +361,7 @@ def compose_api_request_env(
|
|
|
361
361
|
cfg: Any,
|
|
362
362
|
source_obj: Any,
|
|
363
363
|
ex_opts: Mapping[str, Any] | None,
|
|
364
|
-
) ->
|
|
364
|
+
) -> ApiRequestEnvDict:
|
|
365
365
|
"""
|
|
366
366
|
Compose the API request environment.
|
|
367
367
|
|
|
@@ -376,7 +376,7 @@ def compose_api_request_env(
|
|
|
376
376
|
|
|
377
377
|
Returns
|
|
378
378
|
-------
|
|
379
|
-
|
|
379
|
+
ApiRequestEnvDict
|
|
380
380
|
The composed API request environment.
|
|
381
381
|
"""
|
|
382
382
|
ex_opts = ex_opts or {}
|
|
@@ -393,13 +393,13 @@ def compose_api_request_env(
|
|
|
393
393
|
headers: dict[str, str] = cast(dict[str, str], coerce_dict(source_headers))
|
|
394
394
|
pagination = getattr(source_obj, 'pagination', None)
|
|
395
395
|
rate_limit = getattr(source_obj, 'rate_limit', None)
|
|
396
|
-
retry:
|
|
397
|
-
|
|
396
|
+
retry: RetryPolicyDict | None = cast(
|
|
397
|
+
RetryPolicyDict | None,
|
|
398
398
|
getattr(source_obj, 'retry', None),
|
|
399
399
|
)
|
|
400
400
|
retry_network_errors = getattr(source_obj, 'retry_network_errors', None)
|
|
401
401
|
session_cfg = cast(
|
|
402
|
-
|
|
402
|
+
SessionConfigDict | None,
|
|
403
403
|
getattr(source_obj, 'session', None),
|
|
404
404
|
)
|
|
405
405
|
api_name = getattr(source_obj, 'api', None)
|
|
@@ -435,7 +435,7 @@ def compose_api_request_env(
|
|
|
435
435
|
api_cfg.effective_rate_limit_defaults(),
|
|
436
436
|
)
|
|
437
437
|
retry = cast(
|
|
438
|
-
|
|
438
|
+
RetryPolicyDict | None,
|
|
439
439
|
_coalesce(
|
|
440
440
|
retry,
|
|
441
441
|
getattr(ep, 'retry', None),
|
|
@@ -465,8 +465,8 @@ def compose_api_request_env(
|
|
|
465
465
|
timeout: Timeout = ex_opts.get('timeout')
|
|
466
466
|
pag_ov = ex_opts.get('pagination', {})
|
|
467
467
|
rl_ov = ex_opts.get('rate_limit', {})
|
|
468
|
-
rty_ov:
|
|
469
|
-
|
|
468
|
+
rty_ov: RetryPolicyDict | None = cast(
|
|
469
|
+
RetryPolicyDict | None,
|
|
470
470
|
(ex_opts.get('retry') if 'retry' in ex_opts else None),
|
|
471
471
|
)
|
|
472
472
|
rne_ov = (
|
|
@@ -474,7 +474,7 @@ def compose_api_request_env(
|
|
|
474
474
|
if 'retry_network_errors' in ex_opts
|
|
475
475
|
else None
|
|
476
476
|
)
|
|
477
|
-
sess_ov = cast(
|
|
477
|
+
sess_ov = cast(SessionConfigDict | None, ex_opts.get('session'))
|
|
478
478
|
sleep_s = compute_rl_sleep_seconds(rate_limit, rl_ov) or 0.0
|
|
479
479
|
if rty_ov is not None:
|
|
480
480
|
retry = rty_ov
|
|
@@ -485,8 +485,8 @@ def compose_api_request_env(
|
|
|
485
485
|
cast(Mapping[str, Any], session_cfg or {}),
|
|
486
486
|
)
|
|
487
487
|
base_cfg.update(sess_ov)
|
|
488
|
-
session_cfg = cast(
|
|
489
|
-
pag_cfg:
|
|
488
|
+
session_cfg = cast(SessionConfigDict, base_cfg)
|
|
489
|
+
pag_cfg: PaginationConfigDict | None = build_pagination_cfg(
|
|
490
490
|
pagination,
|
|
491
491
|
pag_ov,
|
|
492
492
|
)
|
|
@@ -513,7 +513,7 @@ def compose_api_target_env(
|
|
|
513
513
|
cfg: Any,
|
|
514
514
|
target_obj: Any,
|
|
515
515
|
overrides: Mapping[str, Any] | None,
|
|
516
|
-
) ->
|
|
516
|
+
) -> ApiTargetEnvDict:
|
|
517
517
|
"""
|
|
518
518
|
Compose the API target environment.
|
|
519
519
|
|
|
@@ -528,7 +528,7 @@ def compose_api_target_env(
|
|
|
528
528
|
|
|
529
529
|
Returns
|
|
530
530
|
-------
|
|
531
|
-
|
|
531
|
+
ApiTargetEnvDict
|
|
532
532
|
Composed API target environment.
|
|
533
533
|
"""
|
|
534
534
|
ov = overrides or {}
|
|
@@ -553,8 +553,8 @@ def compose_api_target_env(
|
|
|
553
553
|
timeout: Timeout = (
|
|
554
554
|
cast(Timeout, ov.get('timeout')) if 'timeout' in ov else None
|
|
555
555
|
)
|
|
556
|
-
sess_cfg:
|
|
557
|
-
|
|
556
|
+
sess_cfg: SessionConfigDict | None = cast(
|
|
557
|
+
SessionConfigDict | None,
|
|
558
558
|
ov.get('session'),
|
|
559
559
|
)
|
|
560
560
|
api_name = getattr(target_obj, 'api', None)
|
|
@@ -583,7 +583,7 @@ def compose_api_target_env(
|
|
|
583
583
|
def build_pagination_cfg(
|
|
584
584
|
pagination: PaginationConfig | None,
|
|
585
585
|
overrides: Mapping[str, Any] | None,
|
|
586
|
-
) ->
|
|
586
|
+
) -> PaginationConfigDict | None:
|
|
587
587
|
"""
|
|
588
588
|
Build pagination configuration.
|
|
589
589
|
|
|
@@ -596,7 +596,7 @@ def build_pagination_cfg(
|
|
|
596
596
|
|
|
597
597
|
Returns
|
|
598
598
|
-------
|
|
599
|
-
|
|
599
|
+
PaginationConfigDict | None
|
|
600
600
|
Pagination configuration.
|
|
601
601
|
"""
|
|
602
602
|
ptype: str | None = None
|
|
@@ -683,7 +683,7 @@ def build_pagination_cfg(
|
|
|
683
683
|
case _:
|
|
684
684
|
pass
|
|
685
685
|
|
|
686
|
-
return cast(
|
|
686
|
+
return cast(PaginationConfigDict, cfg)
|
|
687
687
|
|
|
688
688
|
|
|
689
689
|
def paginate_with_client(
|
|
@@ -692,7 +692,7 @@ def paginate_with_client(
|
|
|
692
692
|
params: Params | None,
|
|
693
693
|
headers: Headers | None,
|
|
694
694
|
timeout: Timeout,
|
|
695
|
-
pagination:
|
|
695
|
+
pagination: PaginationConfigDict | None,
|
|
696
696
|
sleep_seconds: float | None,
|
|
697
697
|
) -> Any:
|
|
698
698
|
"""
|
|
@@ -710,7 +710,7 @@ def paginate_with_client(
|
|
|
710
710
|
Headers to include in the API request.
|
|
711
711
|
timeout : Timeout
|
|
712
712
|
Timeout configuration for the API request.
|
|
713
|
-
pagination :
|
|
713
|
+
pagination : PaginationConfigDict | None
|
|
714
714
|
Pagination configuration for the API request.
|
|
715
715
|
sleep_seconds : float | None
|
|
716
716
|
Sleep duration between API requests.
|
|
@@ -771,9 +771,9 @@ def compute_rl_sleep_seconds(
|
|
|
771
771
|
else:
|
|
772
772
|
rl_map = cast(Mapping[str, Any] | None, rate_limit)
|
|
773
773
|
|
|
774
|
-
rl_mapping = cast(
|
|
774
|
+
rl_mapping = cast(RateLimitConfigDict | None, rl_map)
|
|
775
775
|
|
|
776
|
-
typed_override:
|
|
776
|
+
typed_override: RateLimitConfigDict | None = None
|
|
777
777
|
if overrides:
|
|
778
778
|
filtered: dict[str, float | None] = {}
|
|
779
779
|
if 'sleep_seconds' in overrides:
|
|
@@ -787,7 +787,7 @@ def compute_rl_sleep_seconds(
|
|
|
787
787
|
overrides.get('max_per_sec'),
|
|
788
788
|
)
|
|
789
789
|
if filtered:
|
|
790
|
-
typed_override = cast(
|
|
790
|
+
typed_override = cast(RateLimitConfigDict, filtered)
|
|
791
791
|
|
|
792
792
|
return RateLimiter.resolve_sleep_seconds(
|
|
793
793
|
rate_limit=rl_mapping,
|
|
@@ -796,14 +796,14 @@ def compute_rl_sleep_seconds(
|
|
|
796
796
|
|
|
797
797
|
|
|
798
798
|
def build_session(
|
|
799
|
-
cfg:
|
|
799
|
+
cfg: SessionConfigDict | None,
|
|
800
800
|
) -> requests.Session:
|
|
801
801
|
"""
|
|
802
802
|
Build a requests.Session object with the given configuration.
|
|
803
803
|
|
|
804
804
|
Parameters
|
|
805
805
|
----------
|
|
806
|
-
cfg :
|
|
806
|
+
cfg : SessionConfigDict | None
|
|
807
807
|
Session configuration.
|
|
808
808
|
|
|
809
809
|
Returns
|
etlplus/cli/commands.py
CHANGED
|
@@ -61,6 +61,34 @@ __all__ = ['app']
|
|
|
61
61
|
|
|
62
62
|
# SECTION: TYPE ALIASES ==================================================== #
|
|
63
63
|
|
|
64
|
+
|
|
65
|
+
ConfigOption = Annotated[
|
|
66
|
+
str,
|
|
67
|
+
typer.Option(
|
|
68
|
+
...,
|
|
69
|
+
'--config',
|
|
70
|
+
metavar='PATH',
|
|
71
|
+
help='Path to YAML-formatted configuration file.',
|
|
72
|
+
),
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
JobOption = Annotated[
|
|
76
|
+
str | None,
|
|
77
|
+
typer.Option(
|
|
78
|
+
'-j',
|
|
79
|
+
'--job',
|
|
80
|
+
help='Name of the job to run',
|
|
81
|
+
),
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
JobsOption = Annotated[
|
|
85
|
+
bool,
|
|
86
|
+
typer.Option(
|
|
87
|
+
'--jobs',
|
|
88
|
+
help='List available job names and exit',
|
|
89
|
+
),
|
|
90
|
+
]
|
|
91
|
+
|
|
64
92
|
OperationsOption = Annotated[
|
|
65
93
|
str,
|
|
66
94
|
typer.Option(
|
|
@@ -79,13 +107,20 @@ OutputOption = Annotated[
|
|
|
79
107
|
),
|
|
80
108
|
]
|
|
81
109
|
|
|
82
|
-
|
|
83
|
-
str,
|
|
110
|
+
PipelineOption = Annotated[
|
|
111
|
+
str | None,
|
|
84
112
|
typer.Option(
|
|
85
|
-
|
|
86
|
-
'--
|
|
87
|
-
|
|
88
|
-
|
|
113
|
+
'-p',
|
|
114
|
+
'--pipeline',
|
|
115
|
+
help='Name of the pipeline to run',
|
|
116
|
+
),
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
PipelinesOption = Annotated[
|
|
120
|
+
bool,
|
|
121
|
+
typer.Option(
|
|
122
|
+
'--pipelines',
|
|
123
|
+
help='List ETL pipelines',
|
|
89
124
|
),
|
|
90
125
|
]
|
|
91
126
|
|
|
@@ -193,6 +228,22 @@ SourceTypeOption = Annotated[
|
|
|
193
228
|
),
|
|
194
229
|
]
|
|
195
230
|
|
|
231
|
+
SourcesOption = Annotated[
|
|
232
|
+
bool,
|
|
233
|
+
typer.Option(
|
|
234
|
+
'--sources',
|
|
235
|
+
help='List data sources',
|
|
236
|
+
),
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
SummaryOption = Annotated[
|
|
240
|
+
bool,
|
|
241
|
+
typer.Option(
|
|
242
|
+
'--summary',
|
|
243
|
+
help='Show pipeline summary (name, version, sources, targets, jobs)',
|
|
244
|
+
),
|
|
245
|
+
]
|
|
246
|
+
|
|
196
247
|
TargetArg = Annotated[
|
|
197
248
|
str,
|
|
198
249
|
typer.Argument(
|
|
@@ -227,6 +278,22 @@ TargetTypeOption = Annotated[
|
|
|
227
278
|
),
|
|
228
279
|
]
|
|
229
280
|
|
|
281
|
+
TargetsOption = Annotated[
|
|
282
|
+
bool,
|
|
283
|
+
typer.Option(
|
|
284
|
+
'--targets',
|
|
285
|
+
help='List data targets',
|
|
286
|
+
),
|
|
287
|
+
]
|
|
288
|
+
|
|
289
|
+
TransformsOption = Annotated[
|
|
290
|
+
bool,
|
|
291
|
+
typer.Option(
|
|
292
|
+
'--transforms',
|
|
293
|
+
help='List data transforms',
|
|
294
|
+
),
|
|
295
|
+
]
|
|
296
|
+
|
|
230
297
|
|
|
231
298
|
# SECTION: INTERNAL FUNCTIONS =============================================== #
|
|
232
299
|
|
|
@@ -340,37 +407,13 @@ def _root(
|
|
|
340
407
|
@app.command('check')
|
|
341
408
|
def check_cmd(
|
|
342
409
|
ctx: typer.Context,
|
|
343
|
-
config:
|
|
344
|
-
jobs:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
False,
|
|
351
|
-
'--pipelines',
|
|
352
|
-
help='List ETL pipelines',
|
|
353
|
-
),
|
|
354
|
-
sources: bool = typer.Option(
|
|
355
|
-
False,
|
|
356
|
-
'--sources',
|
|
357
|
-
help='List data sources',
|
|
358
|
-
),
|
|
359
|
-
summary: bool = typer.Option(
|
|
360
|
-
False,
|
|
361
|
-
'--summary',
|
|
362
|
-
help='Show pipeline summary (name, version, sources, targets, jobs)',
|
|
363
|
-
),
|
|
364
|
-
targets: bool = typer.Option(
|
|
365
|
-
False,
|
|
366
|
-
'--targets',
|
|
367
|
-
help='List data targets',
|
|
368
|
-
),
|
|
369
|
-
transforms: bool = typer.Option(
|
|
370
|
-
False,
|
|
371
|
-
'--transforms',
|
|
372
|
-
help='List data transforms',
|
|
373
|
-
),
|
|
410
|
+
config: ConfigOption,
|
|
411
|
+
jobs: JobsOption = False,
|
|
412
|
+
pipelines: PipelinesOption = False,
|
|
413
|
+
sources: SourcesOption = False,
|
|
414
|
+
summary: SummaryOption = False,
|
|
415
|
+
targets: TargetsOption = False,
|
|
416
|
+
transforms: TransformsOption = False,
|
|
374
417
|
) -> int:
|
|
375
418
|
"""
|
|
376
419
|
Inspect a pipeline configuration.
|
|
@@ -379,20 +422,20 @@ def check_cmd(
|
|
|
379
422
|
----------
|
|
380
423
|
ctx : typer.Context
|
|
381
424
|
The Typer context.
|
|
382
|
-
config :
|
|
425
|
+
config : ConfigOption
|
|
383
426
|
Path to pipeline YAML configuration file.
|
|
384
|
-
jobs :
|
|
427
|
+
jobs : JobsOption, optional
|
|
385
428
|
List available job names and exit. Default is ``False``.
|
|
386
|
-
pipelines :
|
|
429
|
+
pipelines : PipelinesOption, optional
|
|
387
430
|
List ETL pipelines. Default is ``False``.
|
|
388
|
-
sources :
|
|
431
|
+
sources : SourcesOption, optional
|
|
389
432
|
List data sources. Default is ``False``.
|
|
390
|
-
summary :
|
|
433
|
+
summary : SummaryOption, optional
|
|
391
434
|
Show pipeline summary (name, version, sources, targets, jobs). Default
|
|
392
435
|
is ``False``.
|
|
393
|
-
targets :
|
|
436
|
+
targets : TargetsOption, optional
|
|
394
437
|
List data targets. Default is ``False``.
|
|
395
|
-
transforms :
|
|
438
|
+
transforms : TransformsOption, optional
|
|
396
439
|
List data transforms. Default is ``False``.
|
|
397
440
|
|
|
398
441
|
Returns
|
|
@@ -682,19 +725,9 @@ def render_cmd(
|
|
|
682
725
|
@app.command('run')
|
|
683
726
|
def run_cmd(
|
|
684
727
|
ctx: typer.Context,
|
|
685
|
-
config:
|
|
686
|
-
job:
|
|
687
|
-
|
|
688
|
-
'-j',
|
|
689
|
-
'--job',
|
|
690
|
-
help='Name of the job to run',
|
|
691
|
-
),
|
|
692
|
-
pipeline: str | None = typer.Option(
|
|
693
|
-
None,
|
|
694
|
-
'-p',
|
|
695
|
-
'--pipeline',
|
|
696
|
-
help='Name of the pipeline to run',
|
|
697
|
-
),
|
|
728
|
+
config: ConfigOption,
|
|
729
|
+
job: JobOption = None,
|
|
730
|
+
pipeline: PipelineOption = None,
|
|
698
731
|
) -> int:
|
|
699
732
|
"""
|
|
700
733
|
Execute an ETL job or pipeline from a YAML configuration.
|
|
@@ -703,11 +736,11 @@ def run_cmd(
|
|
|
703
736
|
----------
|
|
704
737
|
ctx : typer.Context
|
|
705
738
|
The Typer context.
|
|
706
|
-
config :
|
|
739
|
+
config : ConfigOption
|
|
707
740
|
Path to pipeline YAML configuration file.
|
|
708
|
-
job :
|
|
741
|
+
job : JobOption, optional
|
|
709
742
|
Name of the job to run. Default is ``None``.
|
|
710
|
-
pipeline :
|
|
743
|
+
pipeline : PipelineOption, optional
|
|
711
744
|
Name of the pipeline to run. Default is ``None``.
|
|
712
745
|
|
|
713
746
|
Returns
|
etlplus/cli/constants.py
CHANGED
|
@@ -8,7 +8,7 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
from typing import Final
|
|
10
10
|
|
|
11
|
-
from ..
|
|
11
|
+
from ..connector import DataConnectorType
|
|
12
12
|
from ..file import FileFormat
|
|
13
13
|
|
|
14
14
|
# SECTION: EXPORTS ========================================================== #
|