tablevalidator-databricks 0.1.6__tar.gz → 0.1.7__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.
Files changed (21) hide show
  1. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/PKG-INFO +2 -2
  2. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/pyproject.toml +6 -1
  3. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks/templates/widget_notebook.py.tmpl +30 -1
  4. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/PKG-INFO +2 -2
  5. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/requires.txt +1 -1
  6. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/scm_version.json +2 -2
  7. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tests/test_generator.py +41 -2
  8. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/README.md +0 -0
  9. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/setup.cfg +0 -0
  10. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks/__init__.py +0 -0
  11. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks/cli/__init__.py +0 -0
  12. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks/cli/main.py +0 -0
  13. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks/generator/__init__.py +0 -0
  14. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks/generator/generator.py +0 -0
  15. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/SOURCES.txt +0 -0
  16. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/dependency_links.txt +0 -0
  17. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/entry_points.txt +0 -0
  18. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/scm_file_list.json +0 -0
  19. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tablevalidator_databricks.egg-info/top_level.txt +0 -0
  20. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tests/test_cli.py +0 -0
  21. {tablevalidator_databricks-0.1.6 → tablevalidator_databricks-0.1.7}/tests/test_generated_notebook_execution.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tablevalidator-databricks
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Generates a widget-driven Databricks notebook UI on top of the table-validator package - no code required to run a comparison.
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: typer>=0.12
9
- Requires-Dist: table-validator>=0.1.19
9
+ Requires-Dist: table-validator>=0.1.22
10
10
  Provides-Extra: dev
11
11
  Requires-Dist: pytest>=7.0; extra == "dev"
12
12
  Requires-Dist: ruff>=0.4; extra == "dev"
@@ -11,7 +11,12 @@ requires-python = ">=3.9"
11
11
  license = { text = "MIT" }
12
12
  dependencies = [
13
13
  "typer>=0.12",
14
- "table-validator>=0.1.19",
14
+ # 0.1.22 is the first release whose result sheets survive Arrow
15
+ # conversion, which is what Databricks' display() uses - older engines
16
+ # fail with "ArrowTypeError: Expected bytes, got a 'int' object" on a
17
+ # column mixing row counts with blanks. The generated notebook's
18
+ # %pip install floor is read from this line.
19
+ "table-validator>=0.1.22",
15
20
  ]
16
21
 
17
22
  [project.optional-dependencies]
@@ -53,7 +53,7 @@
53
53
 
54
54
  # COMMAND ----------
55
55
 
56
- # MAGIC %pip install "table-validator>={{MIN_CORE_VERSION}}"
56
+ # MAGIC %pip install --upgrade "table-validator>={{MIN_CORE_VERSION}}"
57
57
 
58
58
  # COMMAND ----------
59
59
 
@@ -61,12 +61,41 @@ dbutils.library.restartPython()
61
61
 
62
62
  # COMMAND ----------
63
63
 
64
+ import table_validator
64
65
  from table_validator import validate_tables
65
66
  from table_validator.config.schema import ValidationType
66
67
 
67
68
  MODE = "{{MODE}}"
68
69
  SHOW_OPTIONAL_WIDGETS = {{SHOW_OPTIONAL_WIDGETS}}
69
70
 
71
+ # Print what is actually loaded. A %pip install without --upgrade silently
72
+ # keeps an older already-installed engine ("Requirement already
73
+ # satisfied"), so the version that matters is the one imported here, not
74
+ # the one the install cell asked for.
75
+ _MIN_CORE = "{{MIN_CORE_VERSION}}"
76
+ print(f"table-validator engine: {table_validator.__version__} (need >= {_MIN_CORE})")
77
+
78
+
79
+ def _version_tuple(text):
80
+ parts = []
81
+ for chunk in str(text).split(".")[:3]:
82
+ digits = "".join(c for c in chunk if c.isdigit())
83
+ parts.append(int(digits) if digits else 0)
84
+ while len(parts) < 3:
85
+ parts.append(0)
86
+ return tuple(parts)
87
+
88
+
89
+ if _version_tuple(table_validator.__version__) < _version_tuple(_MIN_CORE):
90
+ print(
91
+ f"\n WARNING: this engine ({table_validator.__version__}) is older than "
92
+ f"{_MIN_CORE}, which this notebook expects.\n"
93
+ " You may hit errors such as 'ArrowTypeError: Expected bytes, got a "
94
+ "'int' object' when displaying results.\n"
95
+ " Fix: run the install cell above with --upgrade, then re-run "
96
+ "dbutils.library.restartPython() and start again."
97
+ )
98
+
70
99
 
71
100
  def _list_catalogs():
72
101
  return sorted(r["catalog"] for r in spark.sql("SHOW CATALOGS").collect())
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tablevalidator-databricks
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Generates a widget-driven Databricks notebook UI on top of the table-validator package - no code required to run a comparison.
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: typer>=0.12
9
- Requires-Dist: table-validator>=0.1.19
9
+ Requires-Dist: table-validator>=0.1.22
10
10
  Provides-Extra: dev
11
11
  Requires-Dist: pytest>=7.0; extra == "dev"
12
12
  Requires-Dist: ruff>=0.4; extra == "dev"
@@ -1,5 +1,5 @@
1
1
  typer>=0.12
2
- table-validator>=0.1.19
2
+ table-validator>=0.1.22
3
3
 
4
4
  [dev]
5
5
  pytest>=7.0
@@ -1,7 +1,7 @@
1
1
  {
2
- "tag": "0.1.6",
2
+ "tag": "0.1.7",
3
3
  "distance": 0,
4
- "node": "g85101fc",
4
+ "node": "ga3dbc87",
5
5
  "dirty": false,
6
6
  "branch": "HEAD",
7
7
  "node_date": "2026-09-10"
@@ -103,9 +103,11 @@ def test_generated_notebook_pins_a_core_version_floor(tmp_path: Path) -> None:
103
103
  generate_notebook(output, "full")
104
104
  content = output.read_text(encoding="utf-8")
105
105
 
106
- assert 'pip install "table-validator>=' in content
106
+ assert 'pip install --upgrade "table-validator>=' in content
107
107
  # The floor must be new enough to actually contain validate_tables().
108
- match = re.search(r'pip install "table-validator>=([0-9]+)\.([0-9]+)\.([0-9]+)"', content)
108
+ match = re.search(
109
+ r'pip install --upgrade "table-validator>=([0-9]+)\.([0-9]+)\.([0-9]+)"', content
110
+ )
109
111
  assert match, "no parseable version floor in the %pip install line"
110
112
  major, minor, patch = (int(g) for g in match.groups())
111
113
  assert (major, minor, patch) >= (0, 1, 9)
@@ -131,3 +133,40 @@ def test_generated_notebook_stamps_the_generator_version(tmp_path: Path) -> None
131
133
  # And it explains that regenerating is what picks up new widgets.
132
134
  assert "upgrading the" in content.lower()
133
135
  assert "tablevalidator-databricks init" in content
136
+
137
+
138
+ def test_pip_install_line_forces_an_upgrade(tmp_path: Path) -> None:
139
+ """Real user-reported failure: `%pip install "table-validator"` printed
140
+ "Requirement already satisfied" and kept an older engine (0.1.20),
141
+ which then crashed on display(). The install must force an upgrade so
142
+ an existing older install is actually replaced."""
143
+ output = tmp_path / "TableValidator.py"
144
+ generate_notebook(output, "full")
145
+ content = output.read_text(encoding="utf-8")
146
+
147
+ assert 'pip install --upgrade "table-validator>=' in content
148
+
149
+
150
+ def test_notebook_reports_the_loaded_engine_version(tmp_path: Path) -> None:
151
+ """The version that matters is the one actually imported, not the one
152
+ the install cell asked for - the notebook must print it and warn when
153
+ it is below the required floor."""
154
+ output = tmp_path / "TableValidator.py"
155
+ generate_notebook(output, "full")
156
+ content = output.read_text(encoding="utf-8")
157
+
158
+ assert "table_validator.__version__" in content
159
+ assert "WARNING" in content
160
+ assert "ArrowTypeError" in content
161
+
162
+
163
+ def test_core_version_floor_includes_the_arrow_fix(tmp_path: Path) -> None:
164
+ """The floor must be at least 0.1.22, the first release whose result
165
+ sheets survive Arrow conversion (what Databricks' display() uses)."""
166
+ output = tmp_path / "TableValidator.py"
167
+ generate_notebook(output, "full")
168
+ content = output.read_text(encoding="utf-8")
169
+
170
+ match = re.search(r'table-validator>=([0-9]+)\.([0-9]+)\.([0-9]+)"', content)
171
+ assert match
172
+ assert tuple(int(g) for g in match.groups()) >= (0, 1, 22)