airflow-dbt-python 3.0.2__tar.gz → 3.0.4__tar.gz
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.
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/PKG-INFO +1 -1
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/__version__.py +1 -1
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/target.py +26 -1
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/utils/configs.py +31 -4
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/utils/version.py +4 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/PKG-INFO +1 -1
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/pyproject.toml +1 -21
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/LICENSE +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/README.md +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/__init__.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/__init__.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/dbt.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/fs/__init__.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/fs/gcs.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/fs/git.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/fs/local.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/fs/s3.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/operators/__init__.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/operators/dbt.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/utils/__init__.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/utils/enums.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/utils/env.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/utils/url.py +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/SOURCES.txt +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/dependency_links.txt +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/requires.txt +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/top_level.txt +0 -0
- {airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/setup.cfg +0 -0
|
@@ -7,6 +7,8 @@ specific connection requirements.
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
+
import base64
|
|
11
|
+
import binascii
|
|
10
12
|
import json
|
|
11
13
|
import operator
|
|
12
14
|
import re
|
|
@@ -26,6 +28,24 @@ from airflow.hooks.base import BaseHook
|
|
|
26
28
|
from airflow.models.connection import Connection
|
|
27
29
|
|
|
28
30
|
|
|
31
|
+
def try_decode_base64(s: str) -> str:
|
|
32
|
+
"""Attempt to decode a string from base64.
|
|
33
|
+
|
|
34
|
+
If the string is not valid base64, returns the original value.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
s: The string to decode.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
The decoded string, or the original value if decoding fails.
|
|
41
|
+
"""
|
|
42
|
+
try:
|
|
43
|
+
s = base64.b64decode(s, validate=True).decode("utf-8")
|
|
44
|
+
except binascii.Error:
|
|
45
|
+
pass
|
|
46
|
+
return s
|
|
47
|
+
|
|
48
|
+
|
|
29
49
|
class DbtConnectionParam(NamedTuple):
|
|
30
50
|
"""A tuple indicating connection parameters relevant to dbt.
|
|
31
51
|
|
|
@@ -40,6 +60,7 @@ class DbtConnectionParam(NamedTuple):
|
|
|
40
60
|
name: str
|
|
41
61
|
store_override_name: Optional[str] = None
|
|
42
62
|
default: Optional[Any] = None
|
|
63
|
+
converter: Callable[[Any], Any] | None = None
|
|
43
64
|
|
|
44
65
|
@property
|
|
45
66
|
def override_name(self):
|
|
@@ -230,6 +251,8 @@ class DbtConnectionHook(BaseHook, ABC, metaclass=DbtConnectionHookMeta):
|
|
|
230
251
|
if isinstance(param, DbtConnectionParam):
|
|
231
252
|
key = param.override_name
|
|
232
253
|
value = getattr(conn, param.name, param.default)
|
|
254
|
+
if param.converter:
|
|
255
|
+
value = param.converter(value)
|
|
233
256
|
elif isinstance(param, DbtConnectionConditionParam):
|
|
234
257
|
key, default = param.resolve(conn)
|
|
235
258
|
value = getattr(conn, param.name, default)
|
|
@@ -399,7 +422,9 @@ class DbtSnowflakeHook(DbtConnectionHook):
|
|
|
399
422
|
"database",
|
|
400
423
|
DbtConnectionParam("refresh_token", "token"),
|
|
401
424
|
DbtConnectionParam("private_key_file", "private_key_path"),
|
|
402
|
-
DbtConnectionParam(
|
|
425
|
+
DbtConnectionParam(
|
|
426
|
+
"private_key_content", "private_key", converter=try_decode_base64
|
|
427
|
+
),
|
|
403
428
|
]
|
|
404
429
|
|
|
405
430
|
|
|
@@ -39,7 +39,10 @@ from dbt.task.test import TestTask
|
|
|
39
39
|
from dbt.tracking import initialize_from_flags
|
|
40
40
|
|
|
41
41
|
from airflow_dbt_python.utils.enums import FromStrEnum, LogFormat, Output
|
|
42
|
-
from airflow_dbt_python.utils.version import
|
|
42
|
+
from airflow_dbt_python.utils.version import (
|
|
43
|
+
DBT_INSTALLED_GTE_1_9,
|
|
44
|
+
DBT_INSTALLED_GTE_1_10_7,
|
|
45
|
+
)
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
def parse_yaml_args(args: Optional[Union[str, dict[str, Any]]]) -> dict[str, Any]:
|
|
@@ -181,14 +184,18 @@ class BaseConfig:
|
|
|
181
184
|
|
|
182
185
|
# legacy behaviors - https://github.com/dbt-labs/dbt-core/blob/main/docs/guides/behavior-change-flags.md
|
|
183
186
|
require_batched_execution_for_custom_microbatch_strategy: bool = False
|
|
187
|
+
require_event_names_in_deprecations: bool = False
|
|
184
188
|
require_explicit_package_overrides_for_builtin_materializations: bool = True
|
|
185
|
-
require_resource_names_without_spaces: bool =
|
|
186
|
-
source_freshness_run_project_hooks: bool =
|
|
189
|
+
require_resource_names_without_spaces: bool = True
|
|
190
|
+
source_freshness_run_project_hooks: bool = True
|
|
187
191
|
skip_nodes_if_on_run_start_fails: bool = False
|
|
188
192
|
state_modified_compare_more_unrendered_values: bool = False
|
|
189
193
|
state_modified_compare_vars: bool = False
|
|
190
194
|
require_yaml_configuration_for_mf_time_spines: bool = False
|
|
191
195
|
require_nested_cumulative_type_params: bool = False
|
|
196
|
+
validate_macro_args: bool = False
|
|
197
|
+
require_all_warnings_handled_by_warn_error: bool = False
|
|
198
|
+
require_generic_test_arguments_property: bool = False
|
|
192
199
|
|
|
193
200
|
def __post_init__(self):
|
|
194
201
|
"""Post initialization actions for a dbt configuration."""
|
|
@@ -356,7 +363,11 @@ class BaseConfig:
|
|
|
356
363
|
|
|
357
364
|
runtime_config = self.create_runtime_config(project, profile)
|
|
358
365
|
|
|
359
|
-
if
|
|
366
|
+
if (
|
|
367
|
+
issubclass(self.dbt_task, ConfiguredTask)
|
|
368
|
+
and runtime_config
|
|
369
|
+
and not DBT_INSTALLED_GTE_1_10_7
|
|
370
|
+
):
|
|
360
371
|
manifest = parse_manifest(
|
|
361
372
|
runtime_config,
|
|
362
373
|
write_perf_info=write_perf_info,
|
|
@@ -366,6 +377,22 @@ class BaseConfig:
|
|
|
366
377
|
task: BaseTask = self.dbt_task(
|
|
367
378
|
args=local_flags, config=runtime_config, manifest=manifest
|
|
368
379
|
)
|
|
380
|
+
elif (
|
|
381
|
+
issubclass(self.dbt_task, ConfiguredTask)
|
|
382
|
+
and runtime_config
|
|
383
|
+
and DBT_INSTALLED_GTE_1_10_7
|
|
384
|
+
):
|
|
385
|
+
manifest = parse_manifest(
|
|
386
|
+
runtime_config,
|
|
387
|
+
write_perf_info=write_perf_info,
|
|
388
|
+
write=False,
|
|
389
|
+
write_json=False,
|
|
390
|
+
# TODO: Support for catalog integrations
|
|
391
|
+
active_integrations=[], # type: ignore
|
|
392
|
+
)
|
|
393
|
+
task = self.dbt_task(
|
|
394
|
+
args=local_flags, config=runtime_config, manifest=manifest
|
|
395
|
+
)
|
|
369
396
|
elif issubclass(self.dbt_task, DepsTask):
|
|
370
397
|
task = self.dbt_task(args=local_flags, project=project)
|
|
371
398
|
elif issubclass(self.dbt_task, DebugTask):
|
|
@@ -16,11 +16,15 @@ DBT_1_8 = VersionSpecifier(
|
|
|
16
16
|
DBT_1_9 = VersionSpecifier(
|
|
17
17
|
major="1", minor="9", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
|
|
18
18
|
)
|
|
19
|
+
DBT_1_10_7 = VersionSpecifier(
|
|
20
|
+
major="1", minor="10", patch="7", matcher=Matchers.GREATER_THAN_OR_EQUAL
|
|
21
|
+
)
|
|
19
22
|
DBT_2_0 = VersionSpecifier(
|
|
20
23
|
major="2", minor="0", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
|
|
21
24
|
)
|
|
22
25
|
|
|
23
26
|
DBT_INSTALLED_GTE_1_9 = installed.compare(DBT_1_9) == 1
|
|
27
|
+
DBT_INSTALLED_GTE_1_10_7 = installed.compare(DBT_1_10_7) == 1
|
|
24
28
|
|
|
25
29
|
DBT_INSTALLED_1_8 = DBT_1_8 < installed < DBT_1_9
|
|
26
30
|
DBT_INSTALLED_1_9 = DBT_1_9 < installed < DBT_2_0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "airflow-dbt-python"
|
|
3
|
-
version = "3.0.
|
|
3
|
+
version = "3.0.4"
|
|
4
4
|
description = "A collection of Airflow operators, hooks, and utilities to execute dbt commands"
|
|
5
5
|
authors = [{ name = "Tomás Farías Santana", email = "tomas@tomasfarias.dev" }]
|
|
6
6
|
license = "MIT"
|
|
@@ -71,7 +71,6 @@ dev = [
|
|
|
71
71
|
"apache-airflow-providers-amazon>=3.0.0",
|
|
72
72
|
"apache-airflow-providers-google>=11.0.0",
|
|
73
73
|
"apache-airflow-providers-ssh>=3.0.0",
|
|
74
|
-
"black>=22",
|
|
75
74
|
"boto3-stubs[s3]>=1.26.8",
|
|
76
75
|
"coverage[toml]>=7.2",
|
|
77
76
|
# docutils 0.21 causes an error with poetry (https://github.com/python-poetry/poetry/issues/9293)
|
|
@@ -97,25 +96,6 @@ docs = [
|
|
|
97
96
|
"zipp>=3.19.1",
|
|
98
97
|
]
|
|
99
98
|
|
|
100
|
-
[tool.black]
|
|
101
|
-
line-length = 88
|
|
102
|
-
target-version = ["py39", "py310", "py311", "py312"]
|
|
103
|
-
include = '\.pyi?$'
|
|
104
|
-
exclude = '''
|
|
105
|
-
/(
|
|
106
|
-
\.eggs
|
|
107
|
-
| \.git
|
|
108
|
-
| \.hg
|
|
109
|
-
| \.mypy_cache
|
|
110
|
-
| \.tox
|
|
111
|
-
| \.venv
|
|
112
|
-
| _build
|
|
113
|
-
| buck-out
|
|
114
|
-
| build
|
|
115
|
-
| dist
|
|
116
|
-
)/
|
|
117
|
-
'''
|
|
118
|
-
|
|
119
99
|
[tool.coverage.run]
|
|
120
100
|
source = ["airflow_dbt_python"]
|
|
121
101
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/hooks/fs/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python/operators/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{airflow_dbt_python-3.0.2 → airflow_dbt_python-3.0.4}/airflow_dbt_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|