airflow-dbt-python 2.1.0__py3-none-any.whl → 2.2.0__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.
@@ -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__ = "2.1.0"
6
+ __version__ = "2.2.0"
@@ -25,8 +25,6 @@ from airflow.exceptions import AirflowException
25
25
  from airflow.hooks.base import BaseHook
26
26
  from airflow.models.connection import Connection
27
27
 
28
- from airflow_dbt_python.utils.version import DBT_INSTALLED_GTE_1_8
29
-
30
28
  if sys.version_info >= (3, 11):
31
29
  from contextlib import chdir as chdir_ctx
32
30
  else:
@@ -400,13 +398,7 @@ class DbtHook(BaseHook):
400
398
  default_stdout. As these are initialized by the CLI app, we need to
401
399
  initialize them here.
402
400
  """
403
- if DBT_INSTALLED_GTE_1_8:
404
- from dbt.events.logging import setup_event_logger
405
- else:
406
- from dbt.events.functions import ( # type: ignore[no-redef]
407
- setup_event_logger,
408
- )
409
-
401
+ from dbt.events.logging import setup_event_logger
410
402
  from dbt.flags import get_flags
411
403
 
412
404
  flags = get_flags()
@@ -11,7 +11,7 @@ from typing import Any, Optional, Type, Union
11
11
 
12
12
  import dbt.flags as flags
13
13
  import yaml
14
- from dbt.adapters.factory import register_adapter
14
+ from dbt.cli.option_types import Package
15
15
  from dbt.clients import yaml_helper # type: ignore
16
16
  from dbt.config.profile import Profile, read_profile
17
17
  from dbt.config.project import PartialProject, Project
@@ -20,13 +20,14 @@ from dbt.config.runtime import RuntimeConfig
20
20
  from dbt.contracts.graph.manifest import Manifest
21
21
  from dbt.exceptions import DbtProjectError
22
22
  from dbt.graph.graph import Graph
23
- from dbt.parser.manifest import ManifestLoader, parse_manifest
23
+ from dbt.parser.manifest import parse_manifest
24
24
  from dbt.task.base import BaseTask, ConfiguredTask
25
25
  from dbt.task.build import BuildTask
26
26
  from dbt.task.clean import CleanTask
27
27
  from dbt.task.compile import CompileTask
28
28
  from dbt.task.debug import DebugTask
29
29
  from dbt.task.deps import DepsTask
30
+ from dbt.task.docs.generate import GenerateTask
30
31
  from dbt.task.freshness import FreshnessTask
31
32
  from dbt.task.list import ListTask
32
33
  from dbt.task.run import RunTask
@@ -38,15 +39,7 @@ from dbt.task.test import TestTask
38
39
  from dbt.tracking import initialize_from_flags
39
40
 
40
41
  from airflow_dbt_python.utils.enums import FromStrEnum, LogFormat, Output
41
- from airflow_dbt_python.utils.version import (
42
- DBT_INSTALLED_GTE_1_7,
43
- DBT_INSTALLED_GTE_1_8,
44
- )
45
-
46
- if DBT_INSTALLED_GTE_1_8:
47
- from dbt.task.docs.generate import GenerateTask
48
- else:
49
- from dbt.task.generate import GenerateTask # type: ignore[no-redef]
42
+ from airflow_dbt_python.utils.version import DBT_INSTALLED_GTE_1_9
50
43
 
51
44
 
52
45
  def parse_yaml_args(args: Optional[Union[str, dict[str, Any]]]) -> dict[str, Any]:
@@ -139,34 +132,27 @@ class BaseConfig:
139
132
  default=None, repr=False
140
133
  )
141
134
 
142
- # dbt >= 1.7
143
- if DBT_INSTALLED_GTE_1_7:
144
- from dbt.cli.option_types import Package
145
-
146
- include_saved_query: Optional[bool] = None
147
- no_include_saved_query: Optional[bool] = dataclasses.field(
148
- default=None, repr=False
149
- )
135
+ include_saved_query: Optional[bool] = None
136
+ no_include_saved_query: Optional[bool] = dataclasses.field(default=None, repr=False)
150
137
 
151
- clean_project_files_only: Optional[bool] = None
152
- no_clean_project_files_only: Optional[bool] = dataclasses.field(
153
- default=None, repr=False
154
- )
138
+ clean_project_files_only: Optional[bool] = None
139
+ no_clean_project_files_only: Optional[bool] = dataclasses.field(
140
+ default=None, repr=False
141
+ )
155
142
 
156
- require_resource_names_without_spaces: bool = False
143
+ require_resource_names_without_spaces: bool = False
157
144
 
158
- add_package: Optional[Package] = None
159
- dry_run: bool = False
160
- lock: bool = False
161
- static: bool = False
162
- upgrade: bool = False
145
+ add_package: Optional[Package] = None
146
+ dry_run: bool = False
147
+ lock: bool = False
148
+ static: bool = False
149
+ upgrade: bool = False
163
150
 
164
- if DBT_INSTALLED_GTE_1_8:
165
- require_model_names_without_spaces: bool = False
166
- source_freshness_run_project_hooks: bool = False
167
- exclude_resource_types: list[str] = dataclasses.field(
168
- default_factory=list, repr=False
169
- )
151
+ require_model_names_without_spaces: bool = False
152
+ source_freshness_run_project_hooks: bool = False
153
+ exclude_resource_types: list[str] = dataclasses.field(
154
+ default_factory=list, repr=False
155
+ )
170
156
 
171
157
  def __post_init__(self):
172
158
  """Post initialization actions for a dbt configuration."""
@@ -318,53 +304,33 @@ class BaseConfig:
318
304
  flags.set_from_args(self, {}) # type: ignore
319
305
  project, profile = self.create_dbt_project_and_profile(extra_targets)
320
306
 
321
- self.cls.set_log_format()
307
+ if not DBT_INSTALLED_GTE_1_9:
308
+ self.cls.set_log_format() # type: ignore[attr-defined]
309
+
322
310
  initialize_from_flags(self.send_anonymous_usage_stats, self.profiles_dir)
323
311
 
324
312
  local_flags = flags.get_flags()
325
313
 
326
314
  runtime_config = self.create_runtime_config(project, profile)
327
315
 
328
- if DBT_INSTALLED_GTE_1_8:
329
- if issubclass(self.dbt_task, ConfiguredTask) and runtime_config:
330
- manifest = parse_manifest(
331
- runtime_config,
332
- write_perf_info=write_perf_info,
333
- write=False,
334
- write_json=False,
335
- )
336
- task: BaseTask = self.dbt_task(
337
- args=local_flags, config=runtime_config, manifest=manifest
338
- )
339
- elif issubclass(self.dbt_task, DepsTask):
340
- task = self.dbt_task(args=local_flags, project=project)
341
- elif issubclass(self.dbt_task, DebugTask):
342
- task = self.dbt_task(args=local_flags)
343
- elif issubclass(self.dbt_task, CleanTask):
344
- task = self.dbt_task(args=local_flags, config=project)
345
- else:
346
- task = self.dbt_task(args=local_flags)
316
+ if issubclass(self.dbt_task, ConfiguredTask) and runtime_config:
317
+ manifest = parse_manifest(
318
+ runtime_config,
319
+ write_perf_info=write_perf_info,
320
+ write=False,
321
+ write_json=False,
322
+ )
323
+ task: BaseTask = self.dbt_task(
324
+ args=local_flags, config=runtime_config, manifest=manifest
325
+ )
326
+ elif issubclass(self.dbt_task, DepsTask):
327
+ task = self.dbt_task(args=local_flags, project=project)
328
+ elif issubclass(self.dbt_task, DebugTask):
329
+ task = self.dbt_task(args=local_flags)
330
+ elif issubclass(self.dbt_task, CleanTask):
331
+ task = self.dbt_task(args=local_flags, config=project)
347
332
  else:
348
- if issubclass(self.dbt_task, ConfiguredTask) and runtime_config:
349
- register_adapter(runtime_config) # type: ignore[call-arg]
350
- manifest = ManifestLoader.get_full_manifest(
351
- runtime_config, write_perf_info=write_perf_info
352
- )
353
- task = self.dbt_task(
354
- args=self, # type: ignore[arg-type]
355
- config=runtime_config,
356
- manifest=manifest,
357
- )
358
- elif issubclass(self.dbt_task, DepsTask):
359
- task = self.dbt_task(args=self, project=project)
360
- elif issubclass(self.dbt_task, DebugTask):
361
- task = self.dbt_task(args=self, config=runtime_config) # type: ignore[arg-type,call-arg]
362
- else:
363
- task = self.dbt_task( # type: ignore[call-arg]
364
- args=self, # type: ignore[arg-type]
365
- config=runtime_config,
366
- project=project,
367
- )
333
+ task = self.dbt_task(args=local_flags)
368
334
 
369
335
  if self.compiled_target is not None:
370
336
  # Only supported by subclasses of dbt's GraphRunnableTask.
@@ -473,11 +439,10 @@ class BaseConfig:
473
439
  Returns:
474
440
  A dbt profile for the task represented by this configuration.
475
441
  """
476
- if DBT_INSTALLED_GTE_1_8:
477
- from dbt_common.clients.system import get_env
478
- from dbt_common.context import set_invocation_context
442
+ from dbt_common.clients.system import get_env
443
+ from dbt_common.context import set_invocation_context
479
444
 
480
- set_invocation_context(get_env())
445
+ set_invocation_context(get_env())
481
446
 
482
447
  if self.profiles_dir is not None:
483
448
  raw_profiles = read_profile(self.profiles_dir)
@@ -695,6 +660,7 @@ class TestTaskConfig(SelectionConfig):
695
660
  singular: Optional[bool] = None
696
661
  store_failures: Optional[bool] = None
697
662
  which: str = dataclasses.field(default="test", init=False)
663
+ resource_types: Optional[list[str]] = None
698
664
 
699
665
  def __post_init__(self):
700
666
  """Support for type casting arguments."""
@@ -465,7 +465,7 @@ def tar_dir_from_url(url: URL, tar_url: URL) -> None:
465
465
  except IndexError:
466
466
  compression = ""
467
467
 
468
- with tarfile.open(tar_url, f"w:{compression}") as tf:
468
+ with tarfile.open(tar_url, f"w:{compression}") as tf: # type: ignore[call-overload]
469
469
  for _file in url:
470
470
  tf.add(_file)
471
471
 
@@ -473,6 +473,6 @@ def tar_dir_from_url(url: URL, tar_url: URL) -> None:
473
473
  if __name__ == "__main__":
474
474
  import doctest
475
475
 
476
- import airflow_dbt_python.utils.url as url
476
+ import airflow_dbt_python.utils.url as url_utils
477
477
 
478
- doctest.testmod(url)
478
+ doctest.testmod(url_utils)
@@ -10,18 +10,17 @@ except ImportError:
10
10
 
11
11
  from dbt.version import installed
12
12
 
13
- DBT_1_7 = VersionSpecifier(
14
- major="1", minor="7", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
15
- )
16
13
  DBT_1_8 = VersionSpecifier(
17
14
  major="1", minor="8", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
18
15
  )
19
16
  DBT_1_9 = VersionSpecifier(
20
17
  major="1", minor="9", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
21
18
  )
19
+ DBT_2_0 = VersionSpecifier(
20
+ major="2", minor="0", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
21
+ )
22
22
 
23
- DBT_INSTALLED_GTE_1_7 = installed.compare(DBT_1_7) == 1
24
- DBT_INSTALLED_GTE_1_8 = installed.compare(DBT_1_8) == 1
23
+ DBT_INSTALLED_GTE_1_9 = installed.compare(DBT_1_9) == 1
25
24
 
26
- DBT_INSTALLED_1_7 = DBT_1_7 < installed < DBT_1_8
27
25
  DBT_INSTALLED_1_8 = DBT_1_8 < installed < DBT_1_9
26
+ DBT_INSTALLED_1_9 = DBT_1_9 < installed < DBT_2_0
@@ -1,25 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: airflow-dbt-python
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: A collection of Airflow operators, hooks, and utilities to execute dbt commands
5
- Home-page: https://github.com/tomasfarias/airflow-dbt-python
6
5
  License: MIT
7
6
  Author: Tomás Farías Santana
8
7
  Author-email: tomas@tomasfarias.dev
9
- Requires-Python: >=3.8,<3.13
8
+ Requires-Python: >=3.9,<3.13
10
9
  Classifier: Development Status :: 5 - Production/Stable
11
10
  Classifier: Intended Audience :: Developers
12
11
  Classifier: License :: OSI Approved :: MIT License
13
12
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.8
15
13
  Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.10
19
- Classifier: Programming Language :: Python :: 3.11
20
16
  Classifier: Programming Language :: Python :: 3.12
21
- Classifier: Programming Language :: Python :: 3.8
22
- Classifier: Programming Language :: Python :: 3.9
23
17
  Provides-Extra: adapters
24
18
  Provides-Extra: airflow-providers
25
19
  Provides-Extra: bigquery
@@ -30,17 +24,17 @@ Provides-Extra: redshift
30
24
  Provides-Extra: s3
31
25
  Provides-Extra: snowflake
32
26
  Provides-Extra: spark
33
- Requires-Dist: apache-airflow (>=2.7)
27
+ Requires-Dist: apache-airflow (>=2.8)
34
28
  Requires-Dist: apache-airflow-providers-amazon (>=3.0.0) ; extra == "airflow-providers" or extra == "s3"
35
29
  Requires-Dist: apache-airflow-providers-ssh (>=3.0.0) ; extra == "airflow-providers" or extra == "git"
36
30
  Requires-Dist: connexion (<3.0)
37
31
  Requires-Dist: contextlib-chdir (==1.0.2) ; python_version < "3.11"
38
- Requires-Dist: dbt-bigquery (>=1.7.0,<1.9.0) ; extra == "adapters" or extra == "bigquery"
39
- Requires-Dist: dbt-core (>=1.7.5,<1.9.0)
40
- Requires-Dist: dbt-postgres (>=1.7.0,<1.9.0) ; extra == "adapters" or extra == "postgres"
41
- Requires-Dist: dbt-redshift (>=1.7.0,<1.9.0) ; extra == "adapters" or extra == "redshift"
42
- Requires-Dist: dbt-snowflake (>=1.7.0,<1.9.0) ; extra == "adapters" or extra == "snowflake"
43
- Requires-Dist: dbt-spark (>=1.7.0,<1.9.0) ; extra == "adapters" or extra == "spark"
32
+ Requires-Dist: dbt-bigquery (>=1.8.0,<2.0.0) ; extra == "adapters" or extra == "bigquery"
33
+ Requires-Dist: dbt-core (>=1.8.0,<2.0.0)
34
+ Requires-Dist: dbt-postgres (>=1.8.0,<2.0.0) ; extra == "adapters" or extra == "postgres"
35
+ Requires-Dist: dbt-redshift (>=1.8.0,<2.0.0) ; extra == "adapters" or extra == "redshift"
36
+ Requires-Dist: dbt-snowflake (>=1.8.0,<2.0.0) ; extra == "adapters" or extra == "snowflake"
37
+ Requires-Dist: dbt-spark (>=1.8.0,<2.0.0) ; extra == "adapters" or extra == "spark"
44
38
  Requires-Dist: dulwich (>=0.21) ; extra == "git"
45
39
  Project-URL: Repository, https://github.com/tomasfarias/airflow-dbt-python
46
40
  Description-Content-Type: text/markdown
@@ -62,8 +56,8 @@ Read the [documentation](https://airflow-dbt-python.readthedocs.io) for examples
62
56
  ## Requirements
63
57
 
64
58
  Before using *airflow-dbt-python*, ensure you meet the following requirements:
65
- * A *dbt* project using [dbt-core](https://pypi.org/project/dbt-core/) version 1.7.5 or later.
66
- * An Airflow environment using version 2.7 or later.
59
+ * A *dbt* project using [dbt-core](https://pypi.org/project/dbt-core/) version 1.8 or later.
60
+ * An Airflow environment using version 2.8 or later.
67
61
 
68
62
  * If using any managed service, like AWS MWAA or GCP Cloud Composer 2/3, ensure your environment is created with a supported version of Airflow.
69
63
  * If self-hosting, Airflow installation instructions can be found in their [official documentation](https://airflow.apache.org/docs/apache-airflow/stable/installation/index.html).
@@ -1,7 +1,7 @@
1
1
  airflow_dbt_python/__init__.py,sha256=qYIsTHy4p3NX0QYIsLdatz6GlnaMwYsSoD3wtPD0BqY,153
2
- airflow_dbt_python/__version__.py,sha256=Cg2ny00d28tIcWGoNq-HQZrF04uPVlxF18H_Cg743V4,190
2
+ airflow_dbt_python/__version__.py,sha256=R3gvi55VePWbBsovUbmgfU1cEWnzuFVlZFXx74rtufo,190
3
3
  airflow_dbt_python/hooks/__init__.py,sha256=dcQQ5e8EpcQ_CzKVOeg_cRbqOEmloNLnWSp3B0bDSXs,57
4
- airflow_dbt_python/hooks/dbt.py,sha256=3QOgGpB4sLiFvZZ75v-UF6lQMapAMPHNUkIygEz6cWw,20245
4
+ airflow_dbt_python/hooks/dbt.py,sha256=_M-WnwAgUtlpWP2hIa4g9ZlCy5QFXSYQOL_S5ARucYk,20001
5
5
  airflow_dbt_python/hooks/git.py,sha256=bxzyd1g9WPfZs8ukj-FSafrVki4hyw_GF06jF61ncxk,7126
6
6
  airflow_dbt_python/hooks/localfs.py,sha256=i49VldNRFyvsd8bMdpkWaaviP2VoqMnl-VmHYgrpfZM,5387
7
7
  airflow_dbt_python/hooks/remote.py,sha256=Wx6zP9DH6blIiremwicxgYFxssQ-5Na9UaHyZjcNJSI,5478
@@ -9,12 +9,12 @@ airflow_dbt_python/hooks/s3.py,sha256=AUYtpI609fBzZXCY7esJbdFhijHoMVJWa6lERPFuAr
9
9
  airflow_dbt_python/operators/__init__.py,sha256=zveHW17YWoCpdsQhCZtvdPoEiFiwWykqPnAnOAQ8vk0,46
10
10
  airflow_dbt_python/operators/dbt.py,sha256=6WF6yxjNJZI5HgVLA5eEnoBK7V8Jz2MZcfgEmAXRLg8,22098
11
11
  airflow_dbt_python/utils/__init__.py,sha256=J3_g-tV35XkrZSwYULsAq4B0TUa6rw0uxP-LFwl_k2Q,45
12
- airflow_dbt_python/utils/configs.py,sha256=gxdEc-dQF15Jd42StxOgTdhUHatjLuLIOVW0NO4i4xw,26767
12
+ airflow_dbt_python/utils/configs.py,sha256=BfYyws28MnMYvqgN9YcnrYWXa_x1cs9fmUknbmGFijI,25322
13
13
  airflow_dbt_python/utils/enums.py,sha256=rktUM8cTkEUsdNbzd_f6fxfgNiZGifJfOr0zvrsMyuQ,969
14
14
  airflow_dbt_python/utils/env.py,sha256=o2Y3RMyXADSpUCU-G0yRiqXB-yo3oPsXtCEI7H5GIyM,646
15
- airflow_dbt_python/utils/url.py,sha256=P1JKBuJDLyt0j7KO3BSVP7mpmxmFlLabfAiF5o0u3Q4,16068
16
- airflow_dbt_python/utils/version.py,sha256=xRgpjlUQjzxK3iOQotWEeNNijqcS8rb-2S3CxTM7FIc,867
17
- airflow_dbt_python-2.1.0.dist-info/LICENSE,sha256=8yx5JCe-4cW52JiqVrMlA990r7tuac2foiUryhV9dfY,1073
18
- airflow_dbt_python-2.1.0.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
19
- airflow_dbt_python-2.1.0.dist-info/METADATA,sha256=yVShosgyVGNRRvw_0sa03NeTWgrTz56HHQPS5sgEN24,15859
20
- airflow_dbt_python-2.1.0.dist-info/RECORD,,
15
+ airflow_dbt_python/utils/url.py,sha256=Ac7PJMl3AsrVMXGPgFdzOrAVsvCfS4hMWAtwgRMdbP0,16111
16
+ airflow_dbt_python/utils/version.py,sha256=RAMagzZofIAiFUFc9g06yZXM81BaMI3hH58q4xjfE0M,811
17
+ airflow_dbt_python-2.2.0.dist-info/LICENSE,sha256=8yx5JCe-4cW52JiqVrMlA990r7tuac2foiUryhV9dfY,1073
18
+ airflow_dbt_python-2.2.0.dist-info/METADATA,sha256=Lfx7ptaVOY1ABFbIZe04Ru-ODdZMQf3ie8ct_Hx1LvA,15544
19
+ airflow_dbt_python-2.2.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
20
+ airflow_dbt_python-2.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.4.0
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any