-
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathversion.py
More file actions
43 lines (32 loc) · 1.42 KB
/
Copy pathversion.py
File metadata and controls
43 lines (32 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Provides utilities to differentiate between installed dbt versions.
These are only used to ensure backwards compatibility with older versions of dbt.
"""
try:
from dbt.semver import Matchers, VersionSpecifier
except ImportError:
from dbt_common.semver import Matchers, VersionSpecifier
from dbt.version import installed
DBT_1_8 = VersionSpecifier(
major="1", minor="8", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
)
DBT_1_9 = VersionSpecifier(
major="1", minor="9", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
)
DBT_1_10_7 = VersionSpecifier(
major="1", minor="10", patch="7", matcher=Matchers.GREATER_THAN_OR_EQUAL
)
DBT_2_0 = VersionSpecifier(
major="2", minor="0", patch="0", matcher=Matchers.GREATER_THAN_OR_EQUAL
)
DBT_INSTALLED_GTE_1_9 = installed.compare(DBT_1_9) == 1
DBT_INSTALLED_GTE_1_10_7 = installed.compare(DBT_1_10_7) == 1
DBT_INSTALLED_1_8 = DBT_1_8 < installed < DBT_1_9
DBT_INSTALLED_1_9 = DBT_1_9 < installed < DBT_2_0
def _get_base_airflow_version_tuple() -> tuple[int, int, int]:
from airflow import __version__
from packaging.version import Version
airflow_version = Version(__version__)
return airflow_version.major, airflow_version.minor, airflow_version.micro
AIRFLOW_V_3_0_PLUS = _get_base_airflow_version_tuple() >= (3, 0, 0)
AIRFLOW_V_3_1_PLUS = _get_base_airflow_version_tuple() >= (3, 1, 0)
AIRFLOW_V_3_0 = AIRFLOW_V_3_0_PLUS and not AIRFLOW_V_3_1_PLUS