acryl-datahub 0.15.0.6rc3__py3-none-any.whl → 1.0.0rc2__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-0.15.0.6rc3.dist-info → acryl_datahub-1.0.0rc2.dist-info}/METADATA +2521 -2521
- {acryl_datahub-0.15.0.6rc3.dist-info → acryl_datahub-1.0.0rc2.dist-info}/RECORD +19 -18
- datahub/_version.py +1 -1
- datahub/ingestion/source/kafka_connect/common.py +1 -1
- datahub/ingestion/source/kafka_connect/kafka_connect.py +97 -4
- datahub/ingestion/source/kafka_connect/sink_connectors.py +2 -2
- datahub/ingestion/source/kafka_connect/source_connectors.py +2 -2
- datahub/ingestion/source/snowflake/snowflake_queries.py +3 -0
- datahub/metadata/_schema_classes.py +400 -400
- datahub/metadata/_urns/urn_defs.py +1669 -1669
- datahub/metadata/schema.avsc +15800 -15800
- datahub/metadata/schemas/__init__.py +3 -3
- datahub/testing/check_sql_parser_result.py +5 -6
- datahub/testing/compare_metadata_json.py +7 -6
- datahub/testing/pytest_hooks.py +56 -0
- {acryl_datahub-0.15.0.6rc3.dist-info → acryl_datahub-1.0.0rc2.dist-info}/LICENSE +0 -0
- {acryl_datahub-0.15.0.6rc3.dist-info → acryl_datahub-1.0.0rc2.dist-info}/WHEEL +0 -0
- {acryl_datahub-0.15.0.6rc3.dist-info → acryl_datahub-1.0.0rc2.dist-info}/entry_points.txt +0 -0
- {acryl_datahub-0.15.0.6rc3.dist-info → acryl_datahub-1.0.0rc2.dist-info}/top_level.txt +0 -0
|
@@ -15,10 +15,10 @@ import pathlib
|
|
|
15
15
|
def _load_schema(schema_name: str) -> str:
|
|
16
16
|
return (pathlib.Path(__file__).parent / f"{schema_name}.avsc").read_text()
|
|
17
17
|
|
|
18
|
-
def getMetadataChangeProposalSchema() -> str:
|
|
19
|
-
return _load_schema("MetadataChangeProposal")
|
|
20
|
-
|
|
21
18
|
def getMetadataChangeEventSchema() -> str:
|
|
22
19
|
return _load_schema("MetadataChangeEvent")
|
|
23
20
|
|
|
21
|
+
def getMetadataChangeProposalSchema() -> str:
|
|
22
|
+
return _load_schema("MetadataChangeProposal")
|
|
23
|
+
|
|
24
24
|
# fmt: on
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
import os
|
|
3
2
|
import pathlib
|
|
4
3
|
from typing import Any, Dict, Optional
|
|
5
4
|
|
|
@@ -8,11 +7,10 @@ import deepdiff
|
|
|
8
7
|
from datahub.ingestion.source.bigquery_v2.bigquery_audit import BigqueryTableIdentifier
|
|
9
8
|
from datahub.sql_parsing.schema_resolver import SchemaInfo, SchemaResolver
|
|
10
9
|
from datahub.sql_parsing.sqlglot_lineage import SqlParsingResult, sqlglot_lineage
|
|
10
|
+
from datahub.testing.pytest_hooks import get_golden_settings
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
13
13
|
|
|
14
|
-
UPDATE_FILES = os.environ.get("UPDATE_SQLPARSER_FILES", "false").lower() == "true"
|
|
15
|
-
|
|
16
14
|
|
|
17
15
|
def assert_sql_result_with_resolver(
|
|
18
16
|
sql: str,
|
|
@@ -22,6 +20,8 @@ def assert_sql_result_with_resolver(
|
|
|
22
20
|
allow_table_error: bool = False,
|
|
23
21
|
**kwargs: Any,
|
|
24
22
|
) -> None:
|
|
23
|
+
settings = get_golden_settings()
|
|
24
|
+
|
|
25
25
|
# HACK: Our BigQuery source overwrites this value and doesn't undo it.
|
|
26
26
|
# As such, we need to handle that here.
|
|
27
27
|
BigqueryTableIdentifier._BQ_SHARDED_TABLE_SUFFIX = "_yyyymmdd"
|
|
@@ -47,15 +47,14 @@ def assert_sql_result_with_resolver(
|
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
txt = res.json(indent=4)
|
|
50
|
-
if
|
|
50
|
+
if settings.update_golden:
|
|
51
51
|
expected_file.write_text(txt)
|
|
52
52
|
return
|
|
53
53
|
|
|
54
54
|
if not expected_file.exists():
|
|
55
55
|
expected_file.write_text(txt)
|
|
56
56
|
raise AssertionError(
|
|
57
|
-
f"
|
|
58
|
-
"Created it with the expected output. Please verify it."
|
|
57
|
+
f"Missing expected golden file; run with --update-golden-files to create it: {expected_file}"
|
|
59
58
|
)
|
|
60
59
|
|
|
61
60
|
expected = SqlParsingResult.parse_raw(expected_file.read_text())
|
|
@@ -16,6 +16,7 @@ from deepdiff import DeepDiff
|
|
|
16
16
|
from datahub.ingestion.sink.file import write_metadata_file
|
|
17
17
|
from datahub.ingestion.source.file import read_metadata_file
|
|
18
18
|
from datahub.testing.mcp_diff import CannotCompareMCPs, MCPDiff, get_aspects_by_urn
|
|
19
|
+
from datahub.testing.pytest_hooks import get_golden_settings
|
|
19
20
|
|
|
20
21
|
logger = logging.getLogger(__name__)
|
|
21
22
|
|
|
@@ -40,26 +41,26 @@ def load_json_file(filename: Union[str, os.PathLike]) -> MetadataJson:
|
|
|
40
41
|
def assert_metadata_files_equal(
|
|
41
42
|
output_path: Union[str, os.PathLike],
|
|
42
43
|
golden_path: Union[str, os.PathLike],
|
|
43
|
-
update_golden: bool,
|
|
44
|
-
copy_output: bool,
|
|
45
44
|
ignore_paths: Sequence[str] = (),
|
|
46
45
|
ignore_paths_v2: Sequence[str] = (),
|
|
47
46
|
ignore_order: bool = True,
|
|
48
47
|
) -> None:
|
|
48
|
+
settings = get_golden_settings()
|
|
49
|
+
|
|
49
50
|
golden_exists = os.path.isfile(golden_path)
|
|
50
51
|
|
|
51
|
-
if copy_output:
|
|
52
|
+
if settings.copy_output:
|
|
52
53
|
shutil.copyfile(str(output_path), str(golden_path) + ".output")
|
|
53
54
|
logger.info(f"Copied output file to {golden_path}.output")
|
|
54
55
|
|
|
55
|
-
if not update_golden and not golden_exists:
|
|
56
|
+
if not settings.update_golden and not golden_exists:
|
|
56
57
|
raise FileNotFoundError(
|
|
57
58
|
"Golden file does not exist. Please run with the --update-golden-files option to create."
|
|
58
59
|
)
|
|
59
60
|
|
|
60
61
|
output = load_json_file(output_path)
|
|
61
62
|
|
|
62
|
-
if update_golden and not golden_exists:
|
|
63
|
+
if settings.update_golden and not golden_exists:
|
|
63
64
|
shutil.copyfile(str(output_path), str(golden_path))
|
|
64
65
|
return
|
|
65
66
|
else:
|
|
@@ -87,7 +88,7 @@ def assert_metadata_files_equal(
|
|
|
87
88
|
ignore_paths = (*ignore_paths, *default_exclude_paths)
|
|
88
89
|
|
|
89
90
|
diff = diff_metadata_json(output, golden, ignore_paths, ignore_order=ignore_order)
|
|
90
|
-
if diff and update_golden:
|
|
91
|
+
if diff and settings.update_golden:
|
|
91
92
|
if isinstance(diff, MCPDiff) and diff.is_delta_valid:
|
|
92
93
|
logger.info(f"Applying delta to golden file {golden_path}")
|
|
93
94
|
diff.apply_delta(golden)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import dataclasses
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"load_golden_flags",
|
|
8
|
+
"get_golden_settings",
|
|
9
|
+
"pytest_addoption",
|
|
10
|
+
"GoldenFileSettings",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclasses.dataclass
|
|
15
|
+
class GoldenFileSettings:
|
|
16
|
+
update_golden: bool
|
|
17
|
+
copy_output: bool
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
_registered: bool = False
|
|
21
|
+
_settings: Optional[GoldenFileSettings] = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def pytest_addoption(parser: pytest.Parser) -> None:
|
|
25
|
+
parser.addoption(
|
|
26
|
+
"--update-golden-files",
|
|
27
|
+
action="store_true",
|
|
28
|
+
default=False,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# TODO: Deprecate and remove this flag.
|
|
32
|
+
parser.addoption("--copy-output-files", action="store_true", default=False)
|
|
33
|
+
|
|
34
|
+
global _registered
|
|
35
|
+
_registered = True
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.fixture(scope="session", autouse=True)
|
|
39
|
+
def load_golden_flags(pytestconfig: pytest.Config) -> None:
|
|
40
|
+
global _settings
|
|
41
|
+
_settings = GoldenFileSettings(
|
|
42
|
+
update_golden=pytestconfig.getoption("--update-golden-files"),
|
|
43
|
+
copy_output=pytestconfig.getoption("--copy-output-files"),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_golden_settings() -> GoldenFileSettings:
|
|
48
|
+
if not _registered:
|
|
49
|
+
raise ValueError(
|
|
50
|
+
"Golden files aren't set up properly. Call register_golden_flags from a conftest pytest_addoptions method."
|
|
51
|
+
)
|
|
52
|
+
if not _settings:
|
|
53
|
+
raise ValueError(
|
|
54
|
+
"Golden files aren't set up properly. Ensure load_golden_flags is imported in your conftest."
|
|
55
|
+
)
|
|
56
|
+
return _settings
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|