acryl-datahub 1.1.0.5rc7__py3-none-any.whl → 1.1.0.5rc8__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.
Potentially problematic release.
This version of acryl-datahub might be problematic. Click here for more details.
- {acryl_datahub-1.1.0.5rc7.dist-info → acryl_datahub-1.1.0.5rc8.dist-info}/METADATA +2463 -2465
- {acryl_datahub-1.1.0.5rc7.dist-info → acryl_datahub-1.1.0.5rc8.dist-info}/RECORD +58 -58
- datahub/_version.py +1 -1
- datahub/cli/check_cli.py +0 -7
- datahub/cli/cli_utils.py +73 -0
- datahub/cli/delete_cli.py +0 -6
- datahub/cli/docker_check.py +107 -12
- datahub/cli/docker_cli.py +148 -228
- datahub/cli/exists_cli.py +0 -4
- datahub/cli/get_cli.py +0 -4
- datahub/cli/ingest_cli.py +1 -20
- datahub/cli/put_cli.py +0 -6
- datahub/cli/quickstart_versioning.py +50 -5
- datahub/cli/specific/assertions_cli.py +0 -6
- datahub/cli/specific/datacontract_cli.py +0 -6
- datahub/cli/specific/dataproduct_cli.py +0 -22
- datahub/cli/specific/dataset_cli.py +0 -11
- datahub/cli/specific/forms_cli.py +0 -6
- datahub/cli/specific/group_cli.py +0 -4
- datahub/cli/specific/structuredproperties_cli.py +0 -7
- datahub/cli/specific/user_cli.py +0 -4
- datahub/cli/state_cli.py +0 -4
- datahub/cli/timeline_cli.py +0 -4
- datahub/entrypoints.py +4 -3
- datahub/ingestion/autogenerated/capability_summary.json +88 -23
- datahub/ingestion/extractor/schema_util.py +13 -4
- datahub/ingestion/graph/client.py +2 -2
- datahub/ingestion/run/pipeline.py +43 -0
- datahub/ingestion/source/bigquery_v2/bigquery.py +9 -1
- datahub/ingestion/source/datahub/datahub_database_reader.py +1 -2
- datahub/ingestion/source/dremio/dremio_source.py +1 -4
- datahub/ingestion/source/gcs/gcs_source.py +9 -1
- datahub/ingestion/source/identity/okta.py +0 -13
- datahub/ingestion/source/powerbi/powerbi.py +0 -5
- datahub/ingestion/source/powerbi/rest_api_wrapper/powerbi_api.py +0 -1
- datahub/ingestion/source/powerbi_report_server/report_server.py +0 -23
- datahub/ingestion/source/sigma/sigma.py +6 -1
- datahub/ingestion/source/snowflake/snowflake_config.py +11 -0
- datahub/ingestion/source/snowflake/snowflake_queries.py +100 -58
- datahub/ingestion/source/snowflake/snowflake_v2.py +11 -1
- datahub/ingestion/source/snowflake/stored_proc_lineage.py +1 -1
- datahub/ingestion/source/sql/hive_metastore.py +0 -10
- datahub/ingestion/source/sql/sql_common.py +4 -0
- datahub/ingestion/source/sql/vertica.py +0 -4
- datahub/ingestion/source/sql_queries.py +2 -2
- datahub/ingestion/source/superset.py +56 -1
- datahub/ingestion/source/tableau/tableau.py +40 -34
- datahub/ingestion/source/tableau/tableau_constant.py +0 -2
- datahub/ingestion/source/unity/source.py +9 -1
- datahub/sdk/lineage_client.py +2 -2
- datahub/sql_parsing/sql_parsing_aggregator.py +21 -12
- datahub/sql_parsing/sqlglot_lineage.py +40 -15
- datahub/upgrade/upgrade.py +46 -13
- datahub/utilities/server_config_util.py +8 -0
- {acryl_datahub-1.1.0.5rc7.dist-info → acryl_datahub-1.1.0.5rc8.dist-info}/WHEEL +0 -0
- {acryl_datahub-1.1.0.5rc7.dist-info → acryl_datahub-1.1.0.5rc8.dist-info}/entry_points.txt +0 -0
- {acryl_datahub-1.1.0.5rc7.dist-info → acryl_datahub-1.1.0.5rc8.dist-info}/licenses/LICENSE +0 -0
- {acryl_datahub-1.1.0.5rc7.dist-info → acryl_datahub-1.1.0.5rc8.dist-info}/top_level.txt +0 -0
|
@@ -56,6 +56,7 @@ from datahub.ingestion.source.aws.s3_util import (
|
|
|
56
56
|
from datahub.ingestion.source.common.subtypes import (
|
|
57
57
|
DatasetContainerSubTypes,
|
|
58
58
|
DatasetSubTypes,
|
|
59
|
+
SourceCapabilityModifier,
|
|
59
60
|
)
|
|
60
61
|
from datahub.ingestion.source.state.stale_entity_removal_handler import (
|
|
61
62
|
StaleEntityRemovalHandler,
|
|
@@ -152,7 +153,14 @@ logger: logging.Logger = logging.getLogger(__name__)
|
|
|
152
153
|
@capability(SourceCapability.USAGE_STATS, "Enabled by default")
|
|
153
154
|
@capability(SourceCapability.PLATFORM_INSTANCE, "Enabled by default")
|
|
154
155
|
@capability(SourceCapability.DOMAINS, "Supported via the `domain` config field")
|
|
155
|
-
@capability(
|
|
156
|
+
@capability(
|
|
157
|
+
SourceCapability.CONTAINERS,
|
|
158
|
+
"Enabled by default",
|
|
159
|
+
subtype_modifier=[
|
|
160
|
+
SourceCapabilityModifier.CATALOG,
|
|
161
|
+
SourceCapabilityModifier.SCHEMA,
|
|
162
|
+
],
|
|
163
|
+
)
|
|
156
164
|
@capability(SourceCapability.OWNERSHIP, "Supported via the `include_ownership` config")
|
|
157
165
|
@capability(
|
|
158
166
|
SourceCapability.DATA_PROFILING, "Supported via the `profiling.enabled` config"
|
datahub/sdk/lineage_client.py
CHANGED
|
@@ -478,7 +478,7 @@ class LineageClient:
|
|
|
478
478
|
env: str = "PROD",
|
|
479
479
|
default_db: Optional[str] = None,
|
|
480
480
|
default_schema: Optional[str] = None,
|
|
481
|
-
|
|
481
|
+
override_dialect: Optional[str] = None,
|
|
482
482
|
) -> None:
|
|
483
483
|
"""Add lineage by parsing a SQL query."""
|
|
484
484
|
from datahub.sql_parsing.sqlglot_lineage import (
|
|
@@ -494,7 +494,7 @@ class LineageClient:
|
|
|
494
494
|
platform_instance=platform_instance,
|
|
495
495
|
env=env,
|
|
496
496
|
graph=self._client._graph,
|
|
497
|
-
|
|
497
|
+
override_dialect=override_dialect,
|
|
498
498
|
)
|
|
499
499
|
|
|
500
500
|
if parsed_result.debug_info.table_error:
|
|
@@ -1577,27 +1577,33 @@ class SqlParsingAggregator(Closeable):
|
|
|
1577
1577
|
|
|
1578
1578
|
@dataclasses.dataclass
|
|
1579
1579
|
class QueryLineageInfo:
|
|
1580
|
-
upstreams:
|
|
1581
|
-
|
|
1580
|
+
upstreams: OrderedSet[
|
|
1581
|
+
UrnStr
|
|
1582
|
+
] # this is direct upstreams, with *no temp tables*
|
|
1583
|
+
column_lineage: OrderedSet[ColumnLineageInfo]
|
|
1582
1584
|
confidence_score: float
|
|
1583
1585
|
|
|
1584
1586
|
def _merge_lineage_from(self, other_query: "QueryLineageInfo") -> None:
|
|
1585
|
-
self.upstreams
|
|
1586
|
-
self.column_lineage
|
|
1587
|
+
self.upstreams.update(other_query.upstreams)
|
|
1588
|
+
self.column_lineage.update(other_query.column_lineage)
|
|
1587
1589
|
self.confidence_score = min(
|
|
1588
1590
|
self.confidence_score, other_query.confidence_score
|
|
1589
1591
|
)
|
|
1590
1592
|
|
|
1593
|
+
cache: Dict[str, QueryLineageInfo] = {}
|
|
1594
|
+
|
|
1591
1595
|
def _recurse_into_query(
|
|
1592
1596
|
query: QueryMetadata, recursion_path: List[QueryId]
|
|
1593
1597
|
) -> QueryLineageInfo:
|
|
1594
1598
|
if query.query_id in recursion_path:
|
|
1595
1599
|
# This is a cycle, so we just return the query as-is.
|
|
1596
1600
|
return QueryLineageInfo(
|
|
1597
|
-
upstreams=query.upstreams,
|
|
1598
|
-
column_lineage=query.column_lineage,
|
|
1601
|
+
upstreams=OrderedSet(query.upstreams),
|
|
1602
|
+
column_lineage=OrderedSet(query.column_lineage),
|
|
1599
1603
|
confidence_score=query.confidence_score,
|
|
1600
1604
|
)
|
|
1605
|
+
if query.query_id in cache:
|
|
1606
|
+
return cache[query.query_id]
|
|
1601
1607
|
recursion_path = [*recursion_path, query.query_id]
|
|
1602
1608
|
composed_of_queries.add(query.query_id)
|
|
1603
1609
|
|
|
@@ -1612,7 +1618,7 @@ class SqlParsingAggregator(Closeable):
|
|
|
1612
1618
|
upstream_query = self._query_map.get(upstream_query_id)
|
|
1613
1619
|
if (
|
|
1614
1620
|
upstream_query
|
|
1615
|
-
and upstream_query.query_id not in
|
|
1621
|
+
and upstream_query.query_id not in recursion_path
|
|
1616
1622
|
):
|
|
1617
1623
|
temp_query_lineage_info = _recurse_into_query(
|
|
1618
1624
|
upstream_query, recursion_path
|
|
@@ -1672,11 +1678,14 @@ class SqlParsingAggregator(Closeable):
|
|
|
1672
1678
|
]
|
|
1673
1679
|
)
|
|
1674
1680
|
|
|
1675
|
-
|
|
1676
|
-
upstreams=
|
|
1677
|
-
column_lineage=new_cll,
|
|
1681
|
+
ret = QueryLineageInfo(
|
|
1682
|
+
upstreams=new_upstreams,
|
|
1683
|
+
column_lineage=OrderedSet(new_cll),
|
|
1678
1684
|
confidence_score=new_confidence_score,
|
|
1679
1685
|
)
|
|
1686
|
+
cache[query.query_id] = ret
|
|
1687
|
+
|
|
1688
|
+
return ret
|
|
1680
1689
|
|
|
1681
1690
|
resolved_lineage_info = _recurse_into_query(base_query, [])
|
|
1682
1691
|
|
|
@@ -1716,8 +1725,8 @@ class SqlParsingAggregator(Closeable):
|
|
|
1716
1725
|
base_query,
|
|
1717
1726
|
query_id=composite_query_id,
|
|
1718
1727
|
formatted_query_string=merged_query_text,
|
|
1719
|
-
upstreams=resolved_lineage_info.upstreams,
|
|
1720
|
-
column_lineage=resolved_lineage_info.column_lineage,
|
|
1728
|
+
upstreams=list(resolved_lineage_info.upstreams),
|
|
1729
|
+
column_lineage=list(resolved_lineage_info.column_lineage),
|
|
1721
1730
|
confidence_score=resolved_lineage_info.confidence_score,
|
|
1722
1731
|
)
|
|
1723
1732
|
|
|
@@ -56,6 +56,7 @@ from datahub.sql_parsing.sql_parsing_common import (
|
|
|
56
56
|
QueryTypeProps,
|
|
57
57
|
)
|
|
58
58
|
from datahub.sql_parsing.sqlglot_utils import (
|
|
59
|
+
DialectOrStr,
|
|
59
60
|
get_dialect,
|
|
60
61
|
get_query_fingerprint_debug,
|
|
61
62
|
is_dialect_instance,
|
|
@@ -124,6 +125,17 @@ class _DownstreamColumnRef(_ParserBaseModel):
|
|
|
124
125
|
|
|
125
126
|
|
|
126
127
|
class DownstreamColumnRef(_ParserBaseModel):
|
|
128
|
+
"""
|
|
129
|
+
TODO: Instead of implementing custom __hash__ function this class should simply inherit from _FrozenModel.
|
|
130
|
+
What stops us is that `column_type` field of type `SchemaFieldDataTypeClass` is not hashable - it's an
|
|
131
|
+
auto-generated class from .pdl model files. We need generic solution allowing us to either:
|
|
132
|
+
1. Implement hashing for .pdl model objects
|
|
133
|
+
2. Reliably provide pydantic (both v1 and v2) with information to skip particular fields from default
|
|
134
|
+
hash function - with a twist here that _FrozenModel implements its own `__lt__` function - it needs
|
|
135
|
+
to understand that instruction as well.
|
|
136
|
+
Instances of this class needs to be hashable as we store them in a set when processing lineage from queries.
|
|
137
|
+
"""
|
|
138
|
+
|
|
127
139
|
table: Optional[Urn] = None
|
|
128
140
|
column: str
|
|
129
141
|
column_type: Optional[SchemaFieldDataTypeClass] = None
|
|
@@ -139,8 +151,11 @@ class DownstreamColumnRef(_ParserBaseModel):
|
|
|
139
151
|
return v
|
|
140
152
|
return SchemaFieldDataTypeClass.from_obj(v)
|
|
141
153
|
|
|
154
|
+
def __hash__(self) -> int:
|
|
155
|
+
return hash((self.table, self.column, self.native_column_type))
|
|
142
156
|
|
|
143
|
-
|
|
157
|
+
|
|
158
|
+
class ColumnTransformation(_FrozenModel):
|
|
144
159
|
is_direct_copy: bool
|
|
145
160
|
column_logic: str
|
|
146
161
|
|
|
@@ -153,11 +168,21 @@ class _ColumnLineageInfo(_ParserBaseModel):
|
|
|
153
168
|
|
|
154
169
|
|
|
155
170
|
class ColumnLineageInfo(_ParserBaseModel):
|
|
171
|
+
"""
|
|
172
|
+
TODO: Instead of implementing custom __hash__ function this class should simply inherit from _FrozenModel.
|
|
173
|
+
To achieve this, we need to change `upstreams` to `Tuple[ColumnRef, ...]` - along with many code lines
|
|
174
|
+
depending on it.
|
|
175
|
+
Instances of this class needs to be hashable as we store them in a set when processing lineage from queries.
|
|
176
|
+
"""
|
|
177
|
+
|
|
156
178
|
downstream: DownstreamColumnRef
|
|
157
179
|
upstreams: List[ColumnRef]
|
|
158
180
|
|
|
159
181
|
logic: Optional[ColumnTransformation] = pydantic.Field(default=None)
|
|
160
182
|
|
|
183
|
+
def __hash__(self) -> int:
|
|
184
|
+
return hash((self.downstream, tuple(self.upstreams), self.logic))
|
|
185
|
+
|
|
161
186
|
|
|
162
187
|
class _JoinInfo(_ParserBaseModel):
|
|
163
188
|
join_type: str
|
|
@@ -1231,12 +1256,12 @@ def _sqlglot_lineage_inner(
|
|
|
1231
1256
|
schema_resolver: SchemaResolverInterface,
|
|
1232
1257
|
default_db: Optional[str] = None,
|
|
1233
1258
|
default_schema: Optional[str] = None,
|
|
1234
|
-
|
|
1259
|
+
override_dialect: Optional[DialectOrStr] = None,
|
|
1235
1260
|
) -> SqlParsingResult:
|
|
1236
|
-
if
|
|
1237
|
-
dialect = get_dialect(
|
|
1261
|
+
if override_dialect:
|
|
1262
|
+
dialect = get_dialect(override_dialect)
|
|
1238
1263
|
else:
|
|
1239
|
-
dialect = get_dialect(
|
|
1264
|
+
dialect = get_dialect(schema_resolver.platform)
|
|
1240
1265
|
|
|
1241
1266
|
default_db = _normalize_db_or_schema(default_db, dialect)
|
|
1242
1267
|
default_schema = _normalize_db_or_schema(default_schema, dialect)
|
|
@@ -1423,7 +1448,7 @@ def _sqlglot_lineage_nocache(
|
|
|
1423
1448
|
schema_resolver: SchemaResolverInterface,
|
|
1424
1449
|
default_db: Optional[str] = None,
|
|
1425
1450
|
default_schema: Optional[str] = None,
|
|
1426
|
-
|
|
1451
|
+
override_dialect: Optional[DialectOrStr] = None,
|
|
1427
1452
|
) -> SqlParsingResult:
|
|
1428
1453
|
"""Parse a SQL statement and generate lineage information.
|
|
1429
1454
|
|
|
@@ -1441,8 +1466,8 @@ def _sqlglot_lineage_nocache(
|
|
|
1441
1466
|
can be brittle with respect to missing schema information and complex
|
|
1442
1467
|
SQL logic like UNNESTs.
|
|
1443
1468
|
|
|
1444
|
-
The SQL dialect
|
|
1445
|
-
be
|
|
1469
|
+
The SQL dialect will be inferred from the schema_resolver's platform.
|
|
1470
|
+
That inference can be overridden by passing an override_dialect argument.
|
|
1446
1471
|
The set of supported dialects is the same as sqlglot's. See their
|
|
1447
1472
|
`documentation <https://sqlglot.com/sqlglot/dialects/dialect.html#Dialects>`_
|
|
1448
1473
|
for the full list.
|
|
@@ -1457,7 +1482,7 @@ def _sqlglot_lineage_nocache(
|
|
|
1457
1482
|
schema_resolver: The schema resolver to use for resolving table schemas.
|
|
1458
1483
|
default_db: The default database to use for unqualified table names.
|
|
1459
1484
|
default_schema: The default schema to use for unqualified table names.
|
|
1460
|
-
|
|
1485
|
+
override_dialect: Override the dialect provided by 'schema_resolver'.
|
|
1461
1486
|
|
|
1462
1487
|
Returns:
|
|
1463
1488
|
A SqlParsingResult object containing the parsed lineage information.
|
|
@@ -1482,7 +1507,7 @@ def _sqlglot_lineage_nocache(
|
|
|
1482
1507
|
schema_resolver=schema_resolver,
|
|
1483
1508
|
default_db=default_db,
|
|
1484
1509
|
default_schema=default_schema,
|
|
1485
|
-
|
|
1510
|
+
override_dialect=override_dialect,
|
|
1486
1511
|
)
|
|
1487
1512
|
except Exception as e:
|
|
1488
1513
|
return SqlParsingResult.make_from_error(e)
|
|
@@ -1520,15 +1545,15 @@ def sqlglot_lineage(
|
|
|
1520
1545
|
schema_resolver: SchemaResolverInterface,
|
|
1521
1546
|
default_db: Optional[str] = None,
|
|
1522
1547
|
default_schema: Optional[str] = None,
|
|
1523
|
-
|
|
1548
|
+
override_dialect: Optional[DialectOrStr] = None,
|
|
1524
1549
|
) -> SqlParsingResult:
|
|
1525
1550
|
if schema_resolver.includes_temp_tables():
|
|
1526
1551
|
return _sqlglot_lineage_nocache(
|
|
1527
|
-
sql, schema_resolver, default_db, default_schema,
|
|
1552
|
+
sql, schema_resolver, default_db, default_schema, override_dialect
|
|
1528
1553
|
)
|
|
1529
1554
|
else:
|
|
1530
1555
|
return _sqlglot_lineage_cached(
|
|
1531
|
-
sql, schema_resolver, default_db, default_schema,
|
|
1556
|
+
sql, schema_resolver, default_db, default_schema, override_dialect
|
|
1532
1557
|
)
|
|
1533
1558
|
|
|
1534
1559
|
|
|
@@ -1580,7 +1605,7 @@ def create_lineage_sql_parsed_result(
|
|
|
1580
1605
|
default_schema: Optional[str] = None,
|
|
1581
1606
|
graph: Optional[DataHubGraph] = None,
|
|
1582
1607
|
schema_aware: bool = True,
|
|
1583
|
-
|
|
1608
|
+
override_dialect: Optional[DialectOrStr] = None,
|
|
1584
1609
|
) -> SqlParsingResult:
|
|
1585
1610
|
schema_resolver = create_schema_resolver(
|
|
1586
1611
|
platform=platform,
|
|
@@ -1600,7 +1625,7 @@ def create_lineage_sql_parsed_result(
|
|
|
1600
1625
|
schema_resolver=schema_resolver,
|
|
1601
1626
|
default_db=default_db,
|
|
1602
1627
|
default_schema=default_schema,
|
|
1603
|
-
|
|
1628
|
+
override_dialect=override_dialect,
|
|
1604
1629
|
)
|
|
1605
1630
|
except Exception as e:
|
|
1606
1631
|
return SqlParsingResult.make_from_error(e)
|
datahub/upgrade/upgrade.py
CHANGED
|
@@ -32,6 +32,7 @@ class ServerVersionStats(BaseModel):
|
|
|
32
32
|
current: VersionStats
|
|
33
33
|
latest: Optional[VersionStats] = None
|
|
34
34
|
current_server_type: Optional[str] = None
|
|
35
|
+
current_server_default_cli_version: Optional[VersionStats] = None
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
class ClientVersionStats(BaseModel):
|
|
@@ -44,7 +45,7 @@ class DataHubVersionStats(BaseModel):
|
|
|
44
45
|
client: ClientVersionStats
|
|
45
46
|
|
|
46
47
|
|
|
47
|
-
async def get_client_version_stats():
|
|
48
|
+
async def get_client_version_stats() -> ClientVersionStats:
|
|
48
49
|
import aiohttp
|
|
49
50
|
|
|
50
51
|
current_version_string = __version__
|
|
@@ -52,6 +53,7 @@ async def get_client_version_stats():
|
|
|
52
53
|
client_version_stats: ClientVersionStats = ClientVersionStats(
|
|
53
54
|
current=VersionStats(version=current_version, release_date=None), latest=None
|
|
54
55
|
)
|
|
56
|
+
|
|
55
57
|
async with aiohttp.ClientSession() as session:
|
|
56
58
|
pypi_url = "https://pypi.org/pypi/acryl_datahub/json"
|
|
57
59
|
async with session.get(pypi_url) as resp:
|
|
@@ -131,7 +133,7 @@ async def get_server_config(gms_url: str, token: Optional[str]) -> RestServiceCo
|
|
|
131
133
|
|
|
132
134
|
async def get_server_version_stats(
|
|
133
135
|
server: Optional[DataHubGraph] = None,
|
|
134
|
-
) -> Tuple[Optional[str], Optional[Version], Optional[datetime]]:
|
|
136
|
+
) -> Tuple[Optional[str], Optional[Version], Optional[str], Optional[datetime]]:
|
|
135
137
|
import aiohttp
|
|
136
138
|
|
|
137
139
|
server_config: Optional[RestServiceConfig] = None
|
|
@@ -151,12 +153,13 @@ async def get_server_version_stats(
|
|
|
151
153
|
|
|
152
154
|
server_type = None
|
|
153
155
|
server_version: Optional[Version] = None
|
|
156
|
+
current_server_default_cli_version = None
|
|
154
157
|
current_server_release_date = None
|
|
155
158
|
if server_config:
|
|
156
159
|
server_version_string = server_config.service_version
|
|
157
160
|
commit_hash = server_config.commit_hash
|
|
158
161
|
server_type = server_config.server_type
|
|
159
|
-
|
|
162
|
+
current_server_default_cli_version = server_config.default_cli_version
|
|
160
163
|
if server_type == "quickstart" and commit_hash:
|
|
161
164
|
async with aiohttp.ClientSession(
|
|
162
165
|
headers={"Accept": "application/vnd.github.v3+json"}
|
|
@@ -171,7 +174,12 @@ async def get_server_version_stats(
|
|
|
171
174
|
if server_version_string and server_version_string.startswith("v"):
|
|
172
175
|
server_version = Version(server_version_string[1:])
|
|
173
176
|
|
|
174
|
-
return (
|
|
177
|
+
return (
|
|
178
|
+
server_type,
|
|
179
|
+
server_version,
|
|
180
|
+
current_server_default_cli_version,
|
|
181
|
+
current_server_release_date,
|
|
182
|
+
)
|
|
175
183
|
|
|
176
184
|
|
|
177
185
|
def retrieve_version_stats(
|
|
@@ -214,6 +222,7 @@ async def _retrieve_version_stats(
|
|
|
214
222
|
(
|
|
215
223
|
current_server_type,
|
|
216
224
|
current_server_version,
|
|
225
|
+
current_server_default_cli_version,
|
|
217
226
|
current_server_release_date,
|
|
218
227
|
) = results[2]
|
|
219
228
|
|
|
@@ -223,6 +232,14 @@ async def _retrieve_version_stats(
|
|
|
223
232
|
current=VersionStats(
|
|
224
233
|
version=current_server_version, release_date=current_server_release_date
|
|
225
234
|
),
|
|
235
|
+
current_server_default_cli_version=(
|
|
236
|
+
VersionStats(
|
|
237
|
+
version=Version(current_server_default_cli_version),
|
|
238
|
+
release_date=None,
|
|
239
|
+
)
|
|
240
|
+
if current_server_default_cli_version
|
|
241
|
+
else None
|
|
242
|
+
),
|
|
226
243
|
latest=(
|
|
227
244
|
VersionStats(version=last_server_version, release_date=last_server_date)
|
|
228
245
|
if last_server_version
|
|
@@ -255,21 +272,14 @@ def valid_client_version(version: Version) -> bool:
|
|
|
255
272
|
"""Only version strings like 0.4.5 and 0.6.7.8 are valid. 0.8.6.7rc1 is not"""
|
|
256
273
|
if version.is_prerelease or version.is_postrelease or version.is_devrelease:
|
|
257
274
|
return False
|
|
258
|
-
|
|
259
|
-
return True
|
|
260
|
-
|
|
261
|
-
return False
|
|
275
|
+
return True
|
|
262
276
|
|
|
263
277
|
|
|
264
278
|
def valid_server_version(version: Version) -> bool:
|
|
265
279
|
"""Only version strings like 0.8.x, 0.9.x or 0.10.x are valid. 0.1.x is not"""
|
|
266
280
|
if version.is_prerelease or version.is_postrelease or version.is_devrelease:
|
|
267
281
|
return False
|
|
268
|
-
|
|
269
|
-
if version.major == 0 and version.minor in [8, 9, 10]:
|
|
270
|
-
return True
|
|
271
|
-
|
|
272
|
-
return False
|
|
282
|
+
return True
|
|
273
283
|
|
|
274
284
|
|
|
275
285
|
def is_client_server_compatible(client: VersionStats, server: VersionStats) -> int:
|
|
@@ -291,6 +301,27 @@ def is_client_server_compatible(client: VersionStats, server: VersionStats) -> i
|
|
|
291
301
|
return server.version.micro - client.version.micro
|
|
292
302
|
|
|
293
303
|
|
|
304
|
+
def is_server_default_cli_ahead(version_stats: DataHubVersionStats) -> bool:
|
|
305
|
+
"""
|
|
306
|
+
Check if the server default CLI version is ahead of the current CLI version.
|
|
307
|
+
Returns True if server default CLI is newer and both versions are valid.
|
|
308
|
+
"""
|
|
309
|
+
if not version_stats.server.current_server_default_cli_version:
|
|
310
|
+
return False
|
|
311
|
+
|
|
312
|
+
current_cli = version_stats.client.current
|
|
313
|
+
server_default_cli = version_stats.server.current_server_default_cli_version
|
|
314
|
+
|
|
315
|
+
is_valid_client_version = valid_client_version(current_cli.version)
|
|
316
|
+
is_valid_server_version = valid_client_version(server_default_cli.version)
|
|
317
|
+
|
|
318
|
+
if not (is_valid_client_version and is_valid_server_version):
|
|
319
|
+
return False
|
|
320
|
+
|
|
321
|
+
compatibility_result = is_client_server_compatible(current_cli, server_default_cli)
|
|
322
|
+
return compatibility_result > 0
|
|
323
|
+
|
|
324
|
+
|
|
294
325
|
def _maybe_print_upgrade_message(
|
|
295
326
|
version_stats: Optional[DataHubVersionStats],
|
|
296
327
|
) -> None:
|
|
@@ -429,6 +460,8 @@ def check_upgrade_post(
|
|
|
429
460
|
|
|
430
461
|
|
|
431
462
|
def check_upgrade(func: Callable[..., T]) -> Callable[..., T]:
|
|
463
|
+
log.debug(f"Checking upgrade for {func.__module__}.{func.__name__}")
|
|
464
|
+
|
|
432
465
|
@wraps(func)
|
|
433
466
|
def async_wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
434
467
|
with PerfTimer() as timer:
|
|
@@ -183,6 +183,14 @@ class RestServiceConfig:
|
|
|
183
183
|
managed_ingestion = self.raw_config.get("managedIngestion") or {}
|
|
184
184
|
return managed_ingestion.get("enabled", False)
|
|
185
185
|
|
|
186
|
+
@property
|
|
187
|
+
def default_cli_version(self) -> Optional[str]:
|
|
188
|
+
"""
|
|
189
|
+
Get the default CLI version.
|
|
190
|
+
"""
|
|
191
|
+
managed_ingestion = self.raw_config.get("managedIngestion") or {}
|
|
192
|
+
return managed_ingestion.get("defaultCliVersion")
|
|
193
|
+
|
|
186
194
|
@property
|
|
187
195
|
def is_datahub_cloud(self) -> bool:
|
|
188
196
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|