databricks-schema 0.6.0__tar.gz → 0.6.1__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.
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/.gitignore +4 -1
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/PKG-INFO +1 -1
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/extractor.py +5 -1
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/pyproject.toml +1 -1
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/test_extractor.py +27 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/uv.lock +1 -1
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/.github/workflows/ci.yml +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/.github/workflows/release.yml +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/.python-version +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/CLAUDE.md +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/LICENSE +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/README.md +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/__init__.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/cli.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/diff.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/models.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/sql_gen.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/validate.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/databricks_schema/yaml_io.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/examples/01_extract_schema.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/examples/02_save_load_yaml.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/examples/03_diff_schemas.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/examples/04_generate_sql.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/__init__.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/test_diff.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/test_models.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/test_sql_gen.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/test_validate.py +0 -0
- {databricks_schema-0.6.0 → databricks_schema-0.6.1}/tests/test_yaml_io.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: databricks-schema
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.1
|
|
4
4
|
Summary: Databricks Unity Catalog schema extractor
|
|
5
5
|
Project-URL: Repository, https://github.com/frizzleqq/databricks-schema
|
|
6
6
|
Project-URL: Issues, https://github.com/frizzleqq/databricks-schema/issues
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import logging
|
|
4
4
|
from collections.abc import Iterator
|
|
5
5
|
from concurrent.futures import ThreadPoolExecutor
|
|
6
|
+
from urllib.parse import quote
|
|
6
7
|
|
|
7
8
|
from databricks.sdk import WorkspaceClient
|
|
8
9
|
from databricks.sdk.errors import NotFound
|
|
@@ -22,7 +23,10 @@ class CatalogExtractor:
|
|
|
22
23
|
def _fetch_tags(self, entity_type: str, entity_name: str) -> dict[str, str]:
|
|
23
24
|
tags: dict[str, str] = {}
|
|
24
25
|
try:
|
|
25
|
-
|
|
26
|
+
# Percent-encode entity_name so special characters (e.g. slashes in column names)
|
|
27
|
+
# don't break URL path routing. Dots are safe — they're the UC name separators.
|
|
28
|
+
encoded_name = quote(entity_name, safe=".")
|
|
29
|
+
for assignment in self.client.entity_tag_assignments.list(entity_type, encoded_name):
|
|
26
30
|
key = getattr(assignment, "tag_key", None)
|
|
27
31
|
value = getattr(assignment, "tag_value", None)
|
|
28
32
|
if key is not None:
|
|
@@ -398,6 +398,33 @@ class TestCatalogExtractor:
|
|
|
398
398
|
|
|
399
399
|
client.tables.get.assert_not_called()
|
|
400
400
|
|
|
401
|
+
def test_column_tags_slash_in_name(self):
|
|
402
|
+
"""Column names containing slashes must be percent-encoded before tag lookup."""
|
|
403
|
+
extractor, client = self._extractor()
|
|
404
|
+
sdk_catalog = MagicMock()
|
|
405
|
+
sdk_catalog.comment = None
|
|
406
|
+
client.catalogs.get.return_value = sdk_catalog
|
|
407
|
+
|
|
408
|
+
s = MagicMock()
|
|
409
|
+
s.name = "main"
|
|
410
|
+
s.comment = None
|
|
411
|
+
s.owner = None
|
|
412
|
+
client.schemas.list.return_value = [s]
|
|
413
|
+
|
|
414
|
+
col = _make_col("/example/column", position=1, type_text="STRING")
|
|
415
|
+
sdk_table = _make_sdk_table("orders", columns=[col])
|
|
416
|
+
client.tables.list.return_value = [sdk_table]
|
|
417
|
+
|
|
418
|
+
def mock_list(entity_type, entity_name):
|
|
419
|
+
if entity_type == "columns" and entity_name == "mycat.main.orders.%2Fexample%2Fcolumn":
|
|
420
|
+
return [_make_tag("sensitivity", "high")]
|
|
421
|
+
return []
|
|
422
|
+
|
|
423
|
+
client.entity_tag_assignments.list.side_effect = mock_list
|
|
424
|
+
|
|
425
|
+
catalog = extractor.extract_catalog("mycat")
|
|
426
|
+
assert catalog.schemas[0].tables[0].columns[0].tags == {"sensitivity": "high"}
|
|
427
|
+
|
|
401
428
|
def test_parallel_extraction(self):
|
|
402
429
|
"""With max_workers > 1, all tables are still extracted correctly."""
|
|
403
430
|
extractor, client = self._extractor(max_workers=4)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|