airflow-dbt-python 3.0.4__tar.gz → 3.2.0__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.
Files changed (28) hide show
  1. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/PKG-INFO +8 -6
  2. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/README.md +1 -1
  3. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/__version__.py +1 -1
  4. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/fs/git.py +5 -6
  5. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/fs/local.py +6 -1
  6. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/target.py +37 -3
  7. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/operators/dbt.py +9 -3
  8. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/utils/configs.py +1 -1
  9. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/utils/version.py +13 -0
  10. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python.egg-info/PKG-INFO +8 -6
  11. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python.egg-info/requires.txt +10 -2
  12. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/pyproject.toml +10 -5
  13. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/LICENSE +0 -0
  14. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/__init__.py +0 -0
  15. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/__init__.py +0 -0
  16. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/dbt.py +0 -0
  17. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/fs/__init__.py +0 -0
  18. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/fs/gcs.py +0 -0
  19. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/hooks/fs/s3.py +0 -0
  20. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/operators/__init__.py +0 -0
  21. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/utils/__init__.py +0 -0
  22. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/utils/enums.py +0 -0
  23. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/utils/env.py +0 -0
  24. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python/utils/url.py +0 -0
  25. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python.egg-info/SOURCES.txt +0 -0
  26. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python.egg-info/dependency_links.txt +0 -0
  27. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/airflow_dbt_python.egg-info/top_level.txt +0 -0
  28. {airflow_dbt_python-3.0.4 → airflow_dbt_python-3.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airflow-dbt-python
3
- Version: 3.0.4
3
+ Version: 3.2.0
4
4
  Summary: A collection of Airflow operators, hooks, and utilities to execute dbt commands
5
5
  Author-email: Tomás Farías Santana <tomas@tomasfarias.dev>
6
6
  License-Expression: MIT
@@ -8,14 +8,16 @@ Project-URL: repository, https://github.com/tomasfarias/airflow-dbt-python
8
8
  Project-URL: documentation, https://airflow-dbt-python.readthedocs.io
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
- Requires-Python: <3.13,>=3.9
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: <3.14,>=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: apache-airflow>=2.8
18
+ Requires-Dist: apache-airflow<4.0,>=2.8; python_version < "3.12"
19
+ Requires-Dist: apache-airflow<4.0,>=3.0; python_version >= "3.12" and python_version < "3.13"
20
+ Requires-Dist: apache-airflow<4.0,>=3.1; python_version >= "3.13"
19
21
  Requires-Dist: contextlib-chdir==1.0.2; python_version < "3.11"
20
22
  Requires-Dist: dbt-core<2.0.0,>=1.8.0
21
23
  Provides-Extra: airflow-providers
@@ -34,7 +36,7 @@ Provides-Extra: gcs
34
36
  Requires-Dist: apache-airflow-providers-google>=11.0.0; extra == "gcs"
35
37
  Provides-Extra: git
36
38
  Requires-Dist: apache-airflow-providers-ssh>=3.0.0; extra == "git"
37
- Requires-Dist: dulwich>=0.21; extra == "git"
39
+ Requires-Dist: dulwich>=0.24.3; extra == "git"
38
40
  Provides-Extra: postgres
39
41
  Requires-Dist: dbt-postgres<2.0.0,>=1.8.0; extra == "postgres"
40
42
  Provides-Extra: redshift
@@ -51,7 +53,7 @@ Dynamic: license-file
51
53
 
52
54
  [![PyPI version](https://img.shields.io/pypi/v/airflow-dbt-python?style=plastic)](https://pypi.org/project/airflow-dbt-python/)
53
55
  [![CI testing](https://github.com/tomasfarias/airflow-dbt-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/tomasfarias/airflow-dbt-python/actions)
54
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
56
+ [![Code style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
55
57
  [![Test coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tomasfarias/81ef37701aa088d18db8a58ce07c79c7/raw/covbadge.json)](https://github.com/tomasfarias/airflow-dbt-python/actions)
56
58
  [![Documentation](https://readthedocs.org/projects/airflow-dbt-python/badge/?version=latest)](https://airflow-dbt-python.readthedocs.io/en/latest/?badge=latest)
57
59
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![PyPI version](https://img.shields.io/pypi/v/airflow-dbt-python?style=plastic)](https://pypi.org/project/airflow-dbt-python/)
4
4
  [![CI testing](https://github.com/tomasfarias/airflow-dbt-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/tomasfarias/airflow-dbt-python/actions)
5
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
5
+ [![Code style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
6
6
  [![Test coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tomasfarias/81ef37701aa088d18db8a58ce07c79c7/raw/covbadge.json)](https://github.com/tomasfarias/airflow-dbt-python/actions)
7
7
  [![Documentation](https://readthedocs.org/projects/airflow-dbt-python/badge/?version=latest)](https://airflow-dbt-python.readthedocs.io/en/latest/?badge=latest)
8
8
 
@@ -3,4 +3,4 @@
3
3
  __author__ = "Tomás Farías Santana"
4
4
  __copyright__ = "Copyright 2021 Tomás Farías Santana"
5
5
  __title__ = "airflow-dbt-python"
6
- __version__ = "3.0.4"
6
+ __version__ = "3.2.0"
@@ -127,9 +127,9 @@ class DbtGitFSHook(SSHHook, DbtFSHook):
127
127
  return new_refs
128
128
 
129
129
  client.send_pack(
130
- path,
130
+ path.encode("utf-8"),
131
131
  update_refs,
132
- generate_pack_data=repo.generate_pack_data,
132
+ generate_pack_data=repo.generate_pack_data, # type: ignore
133
133
  )
134
134
 
135
135
  def _download(
@@ -160,8 +160,7 @@ class DbtGitFSHook(SSHHook, DbtFSHook):
160
160
  path,
161
161
  str(destination),
162
162
  mkdir=not destination.exists(),
163
- # NOTE: Dulwich expects branch to be bytes if defined.
164
- branch=branch.encode("utf-8") if isinstance(branch, str) else branch,
163
+ branch=branch,
165
164
  )
166
165
 
167
166
  def get_git_client_path(self, url: URL) -> Tuple[GitClients, str, Optional[str]]:
@@ -191,7 +190,7 @@ class DbtGitFSHook(SSHHook, DbtFSHook):
191
190
  host=url.hostname,
192
191
  port=self.port,
193
192
  username=url.username or self.username,
194
- vendor=vendor,
193
+ vendor=vendor, # type: ignore
195
194
  )
196
195
  path = f"{url.netloc.split(':')[1]}/{str(url.path)}"
197
196
 
@@ -211,7 +210,7 @@ class DbtGitFSHook(SSHHook, DbtFSHook):
211
210
  elif url.authentication.username:
212
211
  base_url = f"{url.scheme}://{url.authentication.username}@{base_url}"
213
212
 
214
- client = HttpGitClient(base_url, **auth_params)
213
+ client = HttpGitClient(base_url, **auth_params) # type: ignore
215
214
 
216
215
  path = str(url.path)
217
216
 
@@ -10,7 +10,12 @@ from functools import partial
10
10
  from pathlib import Path
11
11
  from typing import Optional
12
12
 
13
- from airflow.hooks.filesystem import FSHook
13
+ from airflow_dbt_python.utils.version import AIRFLOW_V_3_0_PLUS
14
+
15
+ if AIRFLOW_V_3_0_PLUS:
16
+ from airflow.providers.standard.hooks.filesystem import FSHook
17
+ else:
18
+ from airflow.hooks.filesystem import FSHook # type: ignore
14
19
 
15
20
  from airflow_dbt_python.hooks.fs import DbtFSHook
16
21
  from airflow_dbt_python.utils.url import URL
@@ -24,8 +24,7 @@ from typing import (
24
24
  Union,
25
25
  )
26
26
 
27
- from airflow.hooks.base import BaseHook
28
- from airflow.models.connection import Connection
27
+ from airflow.providers.common.compat.sdk import BaseHook, Connection
29
28
 
30
29
 
31
30
  def try_decode_base64(s: str) -> str:
@@ -260,7 +259,7 @@ class DbtConnectionHook(BaseHook, ABC, metaclass=DbtConnectionHookMeta):
260
259
  key = param
261
260
  value = getattr(conn, key, None)
262
261
 
263
- if value is None:
262
+ if value is None or value == "":
264
263
  continue
265
264
 
266
265
  dbt_details[key] = value
@@ -492,3 +491,38 @@ class DbtSparkHook(DbtConnectionHook):
492
491
  ),
493
492
  ]
494
493
  conn_extra_params = []
494
+
495
+
496
+ class DbtTrinoHook(DbtConnectionHook):
497
+ """A hook to interact with dbt using a Trino connection."""
498
+
499
+ conn_type = "trino"
500
+ hook_name = "dbt Trino Hook"
501
+ airflow_conn_types = (conn_type,)
502
+
503
+ conn_params = [
504
+ "host",
505
+ DbtConnectionParam("schema", default="public"),
506
+ DbtConnectionParam("login", "user"),
507
+ "password",
508
+ DbtConnectionParam("port", default=443),
509
+ ]
510
+
511
+ conn_extra_params = [
512
+ DbtConnectionParam("type", default="trino"),
513
+ DbtConnectionParam("method", default="none"),
514
+ DbtConnectionParam("http_scheme", default="https"),
515
+ DbtConnectionParam("verify", default=True),
516
+ DbtConnectionParam("database", "catalog", "hive"),
517
+ "catalog",
518
+ "host",
519
+ "port",
520
+ DbtConnectionParam("user", "user"),
521
+ "password",
522
+ "schema",
523
+ "session_properties",
524
+ "http_headers",
525
+ "role",
526
+ "client_tags",
527
+ "source",
528
+ ]
@@ -3,6 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import datetime as dt
6
+ import functools
6
7
  import os
7
8
  from abc import ABC, abstractmethod
8
9
  from dataclasses import asdict, is_dataclass
@@ -10,10 +11,11 @@ from pathlib import Path
10
11
  from typing import TYPE_CHECKING, Any, Dict, Optional, Union
11
12
 
12
13
  from airflow.exceptions import AirflowException
13
- from airflow.models.baseoperator import BaseOperator
14
14
  from airflow.models.xcom import XCOM_RETURN_KEY
15
+ from airflow.providers.common.compat.sdk import BaseOperator
15
16
 
16
17
  from airflow_dbt_python.utils.enums import LogFormat
18
+ from airflow_dbt_python.utils.version import AIRFLOW_V_3_0_PLUS
17
19
 
18
20
  if TYPE_CHECKING:
19
21
  from dbt.contracts.results import RunResult
@@ -344,10 +346,14 @@ class DbtBaseOperator(BaseOperator):
344
346
  serializable_result = self.make_run_results_serializable(
345
347
  dbt_results.run_results
346
348
  )
347
- self.xcom_push(context, key=XCOM_RETURN_KEY, value=serializable_result)
349
+ if AIRFLOW_V_3_0_PLUS:
350
+ xcom_push = context["ti"].xcom_push
351
+ else:
352
+ xcom_push = functools.partial(self.xcom_push, context) # type: ignore
348
353
 
354
+ xcom_push(key=XCOM_RETURN_KEY, value=serializable_result)
349
355
  for key, artifact in dbt_results.artifacts.items():
350
- self.xcom_push(context, key=key, value=artifact)
356
+ xcom_push(key=key, value=artifact)
351
357
 
352
358
  def make_run_results_serializable(
353
359
  self, result: Optional[RunResult]
@@ -368,7 +368,7 @@ class BaseConfig:
368
368
  and runtime_config
369
369
  and not DBT_INSTALLED_GTE_1_10_7
370
370
  ):
371
- manifest = parse_manifest(
371
+ manifest = parse_manifest( # type: ignore
372
372
  runtime_config,
373
373
  write_perf_info=write_perf_info,
374
374
  write=False,
@@ -28,3 +28,16 @@ DBT_INSTALLED_GTE_1_10_7 = installed.compare(DBT_1_10_7) == 1
28
28
 
29
29
  DBT_INSTALLED_1_8 = DBT_1_8 < installed < DBT_1_9
30
30
  DBT_INSTALLED_1_9 = DBT_1_9 < installed < DBT_2_0
31
+
32
+
33
+ def _get_base_airflow_version_tuple() -> tuple[int, int, int]:
34
+ from airflow import __version__
35
+ from packaging.version import Version
36
+
37
+ airflow_version = Version(__version__)
38
+ return airflow_version.major, airflow_version.minor, airflow_version.micro
39
+
40
+
41
+ AIRFLOW_V_3_0_PLUS = _get_base_airflow_version_tuple() >= (3, 0, 0)
42
+ AIRFLOW_V_3_1_PLUS = _get_base_airflow_version_tuple() >= (3, 1, 0)
43
+ AIRFLOW_V_3_0 = AIRFLOW_V_3_0_PLUS and not AIRFLOW_V_3_1_PLUS
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airflow-dbt-python
3
- Version: 3.0.4
3
+ Version: 3.2.0
4
4
  Summary: A collection of Airflow operators, hooks, and utilities to execute dbt commands
5
5
  Author-email: Tomás Farías Santana <tomas@tomasfarias.dev>
6
6
  License-Expression: MIT
@@ -8,14 +8,16 @@ Project-URL: repository, https://github.com/tomasfarias/airflow-dbt-python
8
8
  Project-URL: documentation, https://airflow-dbt-python.readthedocs.io
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
- Requires-Python: <3.13,>=3.9
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: <3.14,>=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: apache-airflow>=2.8
18
+ Requires-Dist: apache-airflow<4.0,>=2.8; python_version < "3.12"
19
+ Requires-Dist: apache-airflow<4.0,>=3.0; python_version >= "3.12" and python_version < "3.13"
20
+ Requires-Dist: apache-airflow<4.0,>=3.1; python_version >= "3.13"
19
21
  Requires-Dist: contextlib-chdir==1.0.2; python_version < "3.11"
20
22
  Requires-Dist: dbt-core<2.0.0,>=1.8.0
21
23
  Provides-Extra: airflow-providers
@@ -34,7 +36,7 @@ Provides-Extra: gcs
34
36
  Requires-Dist: apache-airflow-providers-google>=11.0.0; extra == "gcs"
35
37
  Provides-Extra: git
36
38
  Requires-Dist: apache-airflow-providers-ssh>=3.0.0; extra == "git"
37
- Requires-Dist: dulwich>=0.21; extra == "git"
39
+ Requires-Dist: dulwich>=0.24.3; extra == "git"
38
40
  Provides-Extra: postgres
39
41
  Requires-Dist: dbt-postgres<2.0.0,>=1.8.0; extra == "postgres"
40
42
  Provides-Extra: redshift
@@ -51,7 +53,7 @@ Dynamic: license-file
51
53
 
52
54
  [![PyPI version](https://img.shields.io/pypi/v/airflow-dbt-python?style=plastic)](https://pypi.org/project/airflow-dbt-python/)
53
55
  [![CI testing](https://github.com/tomasfarias/airflow-dbt-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/tomasfarias/airflow-dbt-python/actions)
54
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
56
+ [![Code style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
55
57
  [![Test coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tomasfarias/81ef37701aa088d18db8a58ce07c79c7/raw/covbadge.json)](https://github.com/tomasfarias/airflow-dbt-python/actions)
56
58
  [![Documentation](https://readthedocs.org/projects/airflow-dbt-python/badge/?version=latest)](https://airflow-dbt-python.readthedocs.io/en/latest/?badge=latest)
57
59
 
@@ -1,9 +1,17 @@
1
- apache-airflow>=2.8
2
1
  dbt-core<2.0.0,>=1.8.0
3
2
 
4
3
  [:python_version < "3.11"]
5
4
  contextlib-chdir==1.0.2
6
5
 
6
+ [:python_version < "3.12"]
7
+ apache-airflow<4.0,>=2.8
8
+
9
+ [:python_version >= "3.12" and python_version < "3.13"]
10
+ apache-airflow<4.0,>=3.0
11
+
12
+ [:python_version >= "3.13"]
13
+ apache-airflow<4.0,>=3.1
14
+
7
15
  [adapters]
8
16
  dbt-bigquery<2.0.0,>=1.8.0
9
17
  dbt-redshift<2.0.0,>=1.8.0
@@ -24,7 +32,7 @@ apache-airflow-providers-google>=11.0.0
24
32
 
25
33
  [git]
26
34
  apache-airflow-providers-ssh>=3.0.0
27
- dulwich>=0.21
35
+ dulwich>=0.24.3
28
36
 
29
37
  [postgres]
30
38
  dbt-postgres<2.0.0,>=1.8.0
@@ -1,24 +1,27 @@
1
1
  [project]
2
2
  name = "airflow-dbt-python"
3
- version = "3.0.4"
3
+ version = "3.2.0"
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"
7
7
  readme = "README.md"
8
- requires-python = ">=3.9,<3.13"
8
+ requires-python = ">=3.10,<3.14"
9
9
  classifiers = [
10
10
  "Development Status :: 5 - Production/Stable",
11
11
 
12
12
  "Intended Audience :: Developers",
13
13
 
14
- "Programming Language :: Python :: 3.9",
15
14
  "Programming Language :: Python :: 3.10",
16
15
  "Programming Language :: Python :: 3.11",
17
16
  "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+
18
19
  ]
19
20
 
20
21
  dependencies = [
21
- "apache-airflow>=2.8",
22
+ "apache-airflow>=2.8,<4.0; python_version<'3.12'",
23
+ "apache-airflow>=3.0,<4.0; python_version>='3.12' and python_version<'3.13'",
24
+ "apache-airflow>=3.1,<4.0; python_version>='3.13'",
22
25
  "contextlib-chdir==1.0.2;python_version<'3.11'",
23
26
  "dbt-core>=1.8.0,<2.0.0",
24
27
  ]
@@ -48,7 +51,7 @@ gcs = [
48
51
  ]
49
52
  git = [
50
53
  "apache-airflow-providers-ssh>=3.0.0",
51
- "dulwich>=0.21",
54
+ "dulwich>=0.24.3",
52
55
  ]
53
56
  postgres = [
54
57
  "dbt-postgres>=1.8.0,<2.0.0",
@@ -85,6 +88,8 @@ dev = [
85
88
  "pytest-mock>=3.14.0",
86
89
  "pytest-postgresql>=5",
87
90
  "ruff>=0.0.254",
91
+ # Pinned as Airflow crashes: https://github.com/apache/airflow/issues/57426.
92
+ "structlog<=25.4",
88
93
  "types-PyYAML>=6.0.7",
89
94
  "types-freezegun>=1.1.6",
90
95
  ]