bricksentry 0.1.23__tar.gz → 0.1.24__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.
- {bricksentry-0.1.23 → bricksentry-0.1.24}/CHANGELOG.md +10 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/PKG-INFO +4 -2
- {bricksentry-0.1.23 → bricksentry-0.1.24}/README.md +3 -1
- bricksentry-0.1.24/deploy/databricks-app/requirements.txt +1 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/pyproject.toml +1 -1
- {bricksentry-0.1.23 → bricksentry-0.1.24}/server.json +2 -2
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/__init__.py +1 -1
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/cli.py +1 -1
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/history.py +24 -1
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/job.py +5 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/databricks_template_schema.json +2 -2
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0123.py +74 -0
- bricksentry-0.1.23/deploy/databricks-app/requirements.txt +0 -1
- {bricksentry-0.1.23 → bricksentry-0.1.24}/.gitignore +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/CONTRIBUTING.md +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/LICENSE +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/SECURITY.md +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/action.yml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/deploy/container/Dockerfile +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/deploy/databricks-app/README.md +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/deploy/databricks-app/app.yaml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/deploy/databricks-app/bricksentry.yml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/deploy/databricks-app/databricks.yml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/deploy/databricks-app/grants.sql +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry.yml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_check_my_table.ipynb +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_check_my_table.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_hr_walkthrough.ipynb +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_hr_walkthrough.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_quickstart.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/github-workflow.yml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/policy.yml +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/examples/demo/agent_loop_demo.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/scripts/build_notebook.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/scripts/render_demo_image.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/__main__.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/agent_tools.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/assess.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/backends/__init__.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/backends/base.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/backends/databricks_backend.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/backends/duckdb_backend.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/changes.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/config.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/demo.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/diff.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/explain.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/github.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/job_demo.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/lineage.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/mcp_server.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/measures.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/models.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/netguard.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/notify.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/policy.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/policy_templates.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/preview.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/py.typed +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/src/bricksentry/report.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/README.md +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/.gitignore +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/README.md.tmpl +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/databricks.yml.tmpl +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/resources/bricksentry_check.job.yml.tmpl +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/src/bricksentry_check.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/src/bricksentry_demo.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/conftest.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0110.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0112.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0114.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0120.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0121.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_0122.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_018.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_019.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_assess_policy.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_check_notebook.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_databricks_and_uc.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_demo.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_diff.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_hr_notebook.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_notebook.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_notify_templates.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_preview_agents.py +0 -0
- {bricksentry-0.1.23 → bricksentry-0.1.24}/tests/test_sample_guard_and_store.py +0 -0
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.24 (2026-11-16)
|
|
4
|
+
|
|
5
|
+
Small fixes from two adversarial live tests of 0.1.23 on Databricks, including the job task running inside a real Databricks job.
|
|
6
|
+
|
|
7
|
+
- The job task log no longer ends with IPython's "To exit: use 'exit', 'quit', or Ctrl-D." after a failing verdict (Databricks runs `spark_python_task` scripts inside IPython). The exit code is unchanged.
|
|
8
|
+
- `check-last-change` and the job task report a mistyped or missing table in one line ("Table main.hr.employes not found. Check the catalog, schema and table name…"), and a missing permission as "No permission to read …", instead of the engine's full error with the echoed SQL and unrelated hints. Other history errors keep only their first line. Found in a live test of 0.1.23.
|
|
9
|
+
- `bricksentry test-alert --help` said it exits 1 when no webhook is configured; it exits 2 (configuration error), which the help now says. Found in the live test of 0.1.23.
|
|
10
|
+
- README: "Validated on" covers the live run of 0.1.23.
|
|
11
|
+
- README: the default policy is lenient on changes to a certified table itself (a doubled total only warns); use `builtin:certified` or `builtin:finance` to require a human. From an adversarial live test of 0.1.23.
|
|
12
|
+
|
|
3
13
|
## 0.1.23 (2026-11-16)
|
|
4
14
|
|
|
5
15
|
From a review of accuracy, auditability and documentation:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bricksentry
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.24
|
|
4
4
|
Summary: Change impact analysis and deployment guardrails for data changes on Databricks, for pipelines and the AI agents that edit them: data diffs, Unity Catalog blast radius, policy verdicts and rollback plans.
|
|
5
5
|
Project-URL: Homepage, https://bricksentry.org
|
|
6
6
|
Project-URL: Documentation, https://bricksentry.org/docs
|
|
@@ -422,6 +422,8 @@ Start from a ready-made policy instead of writing one:
|
|
|
422
422
|
|
|
423
423
|
Use one directly with `policy: builtin:finance`, or write an editable copy with `bricksentry init --policy finance`. `bricksentry policies finance` prints it. Tags come from Unity Catalog, so tag your tables `pii` or `certified` for those templates to apply.
|
|
424
424
|
|
|
425
|
+
**The default policy is lenient on certified tables themselves.** It asks a human when a change reaches something *downstream* that's tagged `certified`, but a change *to* a certified table is treated like any other: doubling its totals only warns (`numeric-total-moved`), because many certified marts are rebuilt every day and their totals move for good reasons. If a certified table must not change quietly, use `builtin:certified` (any change to it needs a human, a type change blocks), `builtin:finance` for money tables, or tag the columns that matter so `changed_column_tag` rules apply.
|
|
426
|
+
|
|
425
427
|
### Policy conditions
|
|
426
428
|
|
|
427
429
|
`table` (glob) · `tag` · `downstream_tag` · `downstream_kind` · `downstream_count_gt` · `removed_pct_gt` · `added_pct_gt` · `changed_pct_gt` · `row_count_change_pct_gt` · `row_count_drop_pct_gt` · `column_removed` · `column_added` · `column_type_changed` · `duplicate_keys` · `null_keys` · `sum_change_pct_gt` / `null_increase_gt` (optionally with `column`) · `changed_column` (glob) · `changed_column_tag` · `downstream_column_tag` · `any_change` · `diff_error` · `lineage_error`
|
|
@@ -459,7 +461,7 @@ Every assessment records when it ran (UTC), the bricksentry version, a SHA-256 f
|
|
|
459
461
|
- **Lineage is recorded at runtime.** Brand-new tables have no downstream history yet. Unity Catalog doesn't capture RDD operations, and UDFs hide column-level mapping; column lineage records source-to-target derivations, so a column used only in a filter or join may not appear.
|
|
460
462
|
- **Keys are required.** Tables without a stable key can't be diffed row by row yet (an aggregate-profile mode is planned).
|
|
461
463
|
- **Changed-table detection uses path globs** from config. It doesn't parse Asset Bundles yet.
|
|
462
|
-
- **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.
|
|
464
|
+
- **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.23 on a Free Edition workspace with an HR pipeline: pull-request gating with comment updates, the bundle demo job, `check-last-change` and the newer-changes warning in the CLI, report, JSON and Slack, the refused-statement guards, outbound-URL checks, one-to-one matching of 2,000 NULL keys, exact totals over a million decimal rows, the audit trail, an AI agent attempting six risky changes on the live pipeline, and the job task blocking a bad MERGE inside a real Databricks job. The automated tests use DuckDB and a mocked SDK, so please [open an issue](https://github.com/bricksentry/bricksentry/issues) if something behaves differently on yours.
|
|
463
465
|
|
|
464
466
|
## Roadmap
|
|
465
467
|
|
|
@@ -375,6 +375,8 @@ Start from a ready-made policy instead of writing one:
|
|
|
375
375
|
|
|
376
376
|
Use one directly with `policy: builtin:finance`, or write an editable copy with `bricksentry init --policy finance`. `bricksentry policies finance` prints it. Tags come from Unity Catalog, so tag your tables `pii` or `certified` for those templates to apply.
|
|
377
377
|
|
|
378
|
+
**The default policy is lenient on certified tables themselves.** It asks a human when a change reaches something *downstream* that's tagged `certified`, but a change *to* a certified table is treated like any other: doubling its totals only warns (`numeric-total-moved`), because many certified marts are rebuilt every day and their totals move for good reasons. If a certified table must not change quietly, use `builtin:certified` (any change to it needs a human, a type change blocks), `builtin:finance` for money tables, or tag the columns that matter so `changed_column_tag` rules apply.
|
|
379
|
+
|
|
378
380
|
### Policy conditions
|
|
379
381
|
|
|
380
382
|
`table` (glob) · `tag` · `downstream_tag` · `downstream_kind` · `downstream_count_gt` · `removed_pct_gt` · `added_pct_gt` · `changed_pct_gt` · `row_count_change_pct_gt` · `row_count_drop_pct_gt` · `column_removed` · `column_added` · `column_type_changed` · `duplicate_keys` · `null_keys` · `sum_change_pct_gt` / `null_increase_gt` (optionally with `column`) · `changed_column` (glob) · `changed_column_tag` · `downstream_column_tag` · `any_change` · `diff_error` · `lineage_error`
|
|
@@ -412,7 +414,7 @@ Every assessment records when it ran (UTC), the bricksentry version, a SHA-256 f
|
|
|
412
414
|
- **Lineage is recorded at runtime.** Brand-new tables have no downstream history yet. Unity Catalog doesn't capture RDD operations, and UDFs hide column-level mapping; column lineage records source-to-target derivations, so a column used only in a filter or join may not appear.
|
|
413
415
|
- **Keys are required.** Tables without a stable key can't be diffed row by row yet (an aggregate-profile mode is planned).
|
|
414
416
|
- **Changed-table detection uses path globs** from config. It doesn't parse Asset Bundles yet.
|
|
415
|
-
- **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.
|
|
417
|
+
- **Validated on Databricks** (serverless, November 2026): a 2-million-row table with 0.1.4 (lineage, rollback plans, previews on shallow clones, every verdict level, the sampling guard catching a single changed row), then live runs of every release up to 0.1.23 on a Free Edition workspace with an HR pipeline: pull-request gating with comment updates, the bundle demo job, `check-last-change` and the newer-changes warning in the CLI, report, JSON and Slack, the refused-statement guards, outbound-URL checks, one-to-one matching of 2,000 NULL keys, exact totals over a million decimal rows, the audit trail, an AI agent attempting six risky changes on the live pipeline, and the job task blocking a bad MERGE inside a real Databricks job. The automated tests use DuckDB and a mocked SDK, so please [open an issue](https://github.com/bricksentry/bricksentry/issues) if something behaves differently on yours.
|
|
416
418
|
|
|
417
419
|
## Roadmap
|
|
418
420
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bricksentry[databricks,mcp]==0.1.24
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bricksentry"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.24"
|
|
8
8
|
description = "Change impact analysis and deployment guardrails for data changes on Databricks, for pipelines and the AI agents that edit them: data diffs, Unity Catalog blast radius, policy verdicts and rollback plans."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
10
|
"websiteUrl": "https://bricksentry.org",
|
|
11
|
-
"version": "0.1.
|
|
11
|
+
"version": "0.1.24",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "pypi",
|
|
15
15
|
"identifier": "bricksentry-mcp",
|
|
16
|
-
"version": "0.1.
|
|
16
|
+
"version": "0.1.24",
|
|
17
17
|
"runtimeHint": "uvx",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
@@ -395,7 +395,7 @@ def policies(name):
|
|
|
395
395
|
def test_alert(verdict, owner, config_path):
|
|
396
396
|
"""Send a clearly labelled sample alert to your Slack / Teams webhooks.
|
|
397
397
|
|
|
398
|
-
Reads no tables. Exits 1 if a webhook failed or none is configured."""
|
|
398
|
+
Reads no tables. Exits 1 if a webhook failed or was skipped, 2 if none is configured."""
|
|
399
399
|
from bricksentry.notify import NotifySettings, sample_assessment, send
|
|
400
400
|
|
|
401
401
|
cfg = _config(config_path)
|
|
@@ -177,6 +177,29 @@ def _ensure_scratch(db: Any, schema: str) -> None:
|
|
|
177
177
|
raise
|
|
178
178
|
|
|
179
179
|
|
|
180
|
+
_NOT_FOUND = re.compile(
|
|
181
|
+
r"TABLE_OR_VIEW_NOT_FOUND|cannot be found|does not exist|not found|no such table", re.IGNORECASE)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _read_history(db: Any, table: str, limit: int) -> list[dict[str, Any]]:
|
|
185
|
+
"""DESCRIBE HISTORY, with a one-line message for the common mistakes instead of the
|
|
186
|
+
engine's full error (which echoes the SQL and adds unrelated hints)."""
|
|
187
|
+
try:
|
|
188
|
+
return db.history(table, limit)
|
|
189
|
+
except Exception as e:
|
|
190
|
+
msg = str(e)
|
|
191
|
+
if _NOT_FOUND.search(msg):
|
|
192
|
+
raise ValueError(
|
|
193
|
+
f"Table {table} not found. Check the catalog, schema and table name (they must match "
|
|
194
|
+
"Unity Catalog exactly) and that you have SELECT on it.") from None
|
|
195
|
+
if "PERMISSION_DENIED" in msg or "INSUFFICIENT_PERMISSIONS" in msg:
|
|
196
|
+
raise ValueError(
|
|
197
|
+
f"No permission to read {table}: check-last-change needs SELECT on the table "
|
|
198
|
+
"(and its Delta history).") from None
|
|
199
|
+
first = (msg.strip().splitlines() or [type(e).__name__])[0][:300]
|
|
200
|
+
raise RuntimeError(f"Could not read the history of {table}: {first}") from None
|
|
201
|
+
|
|
202
|
+
|
|
180
203
|
def check_change(
|
|
181
204
|
sentry: Sentry,
|
|
182
205
|
table: str,
|
|
@@ -195,7 +218,7 @@ def check_change(
|
|
|
195
218
|
if not _NAME.fullmatch(table):
|
|
196
219
|
raise ValueError(f"table must be schema.table or catalog.schema.table; got {table!r}")
|
|
197
220
|
|
|
198
|
-
history = db
|
|
221
|
+
history = _read_history(db, table, history_limit)
|
|
199
222
|
change = pick_change(table, history, version=version, since=since)
|
|
200
223
|
keys = keys or sentry.config.spec(table).keys or db.primary_key(table)
|
|
201
224
|
if not keys:
|
|
@@ -17,6 +17,7 @@ import argparse
|
|
|
17
17
|
import json
|
|
18
18
|
import os
|
|
19
19
|
import sys
|
|
20
|
+
import warnings
|
|
20
21
|
from datetime import datetime, timedelta, timezone
|
|
21
22
|
from typing import Any
|
|
22
23
|
|
|
@@ -185,6 +186,10 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
185
186
|
even ``SystemExit(0)``, as a task error, so a clean run must simply return."""
|
|
186
187
|
code = run(argv)
|
|
187
188
|
if code:
|
|
189
|
+
# In a spark_python_task the script runs inside IPython, which follows a
|
|
190
|
+
# SystemExit with "To exit: use 'exit', 'quit', or Ctrl-D." at the end of the
|
|
191
|
+
# task log. The exit code is what matters, so keep that line out of the log.
|
|
192
|
+
warnings.filterwarnings("ignore", message="To exit: use")
|
|
188
193
|
sys.exit(code)
|
|
189
194
|
|
|
190
195
|
|
{bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/databricks_template_schema.json
RENAMED
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
},
|
|
87
87
|
"bricksentry_version": {
|
|
88
88
|
"type": "string",
|
|
89
|
-
"default": "0.1.
|
|
89
|
+
"default": "0.1.24",
|
|
90
90
|
"description": "bricksentry version to install in the job (pinned; change it and redeploy to upgrade)",
|
|
91
91
|
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
|
92
|
-
"pattern_match_failure_message": "Use a version like 0.1.
|
|
92
|
+
"pattern_match_failure_message": "Use a version like 0.1.24.",
|
|
93
93
|
"order": 10
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -119,3 +119,77 @@ def test_old_saved_assessments_still_load():
|
|
|
119
119
|
old = {"id": "abc", "verdict": "pass", "tables": [], "notify": []}
|
|
120
120
|
a = Assessment.from_dict(old)
|
|
121
121
|
assert a.created_at is None and a.policy_sha256 is None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# --- friendly errors for a mistyped table (found in a live test of 0.1.23) ---------
|
|
125
|
+
class _HistoryFails:
|
|
126
|
+
"""A Delta-like backend whose DESCRIBE HISTORY raises the given engine error."""
|
|
127
|
+
|
|
128
|
+
name = "fake"
|
|
129
|
+
supports_time_travel = True
|
|
130
|
+
|
|
131
|
+
def __init__(self, message):
|
|
132
|
+
self.message = message
|
|
133
|
+
|
|
134
|
+
def history(self, table, limit=50):
|
|
135
|
+
raise RuntimeError(self.message)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _check(message):
|
|
139
|
+
import pytest
|
|
140
|
+
|
|
141
|
+
from bricksentry.history import _read_history
|
|
142
|
+
|
|
143
|
+
with pytest.raises((ValueError, RuntimeError)) as e:
|
|
144
|
+
_read_history(_HistoryFails(message), "main.hr.employes", 50)
|
|
145
|
+
return e.value
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def test_typo_in_table_name_is_one_clear_line():
|
|
149
|
+
raw = ("[TABLE_OR_VIEW_NOT_FOUND] The table or view `main`.`hr`.`employes` cannot be found. "
|
|
150
|
+
"Verify the spelling and correctness of the schema and catalog.\nIf you did not qualify the "
|
|
151
|
+
"name with a schema, verify the current_schema() output, or qualify the name with the correct "
|
|
152
|
+
"schema and catalog.\nTo tolerate the error on drop use DROP VIEW IF EXISTS or DROP TABLE IF "
|
|
153
|
+
"EXISTS. SQLSTATE: 42P01; line 1 pos 17;\n'DescribeDeltaHistory ...")
|
|
154
|
+
e = _check(raw)
|
|
155
|
+
assert isinstance(e, ValueError)
|
|
156
|
+
assert str(e).startswith("Table main.hr.employes not found.")
|
|
157
|
+
assert "DROP VIEW" not in str(e) and "\n" not in str(e)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def test_permission_and_other_errors():
|
|
161
|
+
e = _check("[INSUFFICIENT_PERMISSIONS] User does not have SELECT on table")
|
|
162
|
+
assert isinstance(e, ValueError) and "No permission to read main.hr.employes" in str(e)
|
|
163
|
+
e = _check("something odd happened\nwith a long second line")
|
|
164
|
+
assert isinstance(e, RuntimeError)
|
|
165
|
+
assert str(e) == "Could not read the history of main.hr.employes: something odd happened"
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_job_task_reports_a_typo_cleanly():
|
|
169
|
+
from bricksentry.job import run
|
|
170
|
+
|
|
171
|
+
lines = []
|
|
172
|
+
raw = ("[TABLE_OR_VIEW_NOT_FOUND] The table or view `main`.`hr`.`employes` cannot be found.\n"
|
|
173
|
+
"To tolerate the error on drop use DROP VIEW IF EXISTS. SQLSTATE: 42P01")
|
|
174
|
+
code = run(["--tables", "main.hr.employes", "--key", "id"], backend=_HistoryFails(raw), out=lines.append)
|
|
175
|
+
assert code == 2
|
|
176
|
+
err = [ln for ln in lines if "ERROR" in ln]
|
|
177
|
+
assert err == ["main.hr.employes: ERROR Table main.hr.employes not found. Check the catalog, schema and "
|
|
178
|
+
"table name (they must match Unity Catalog exactly) and that you have SELECT on it."]
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_job_main_exits_without_the_ipython_exit_hint(monkeypatch):
|
|
182
|
+
import warnings
|
|
183
|
+
|
|
184
|
+
import pytest
|
|
185
|
+
|
|
186
|
+
from bricksentry import job
|
|
187
|
+
|
|
188
|
+
monkeypatch.setattr(job, "run", lambda argv=None: 1)
|
|
189
|
+
with warnings.catch_warnings(record=True) as caught:
|
|
190
|
+
warnings.simplefilter("default")
|
|
191
|
+
with pytest.raises(SystemExit) as e:
|
|
192
|
+
job.main([])
|
|
193
|
+
warnings.warn("To exit: use 'exit', 'quit', or Ctrl-D.", UserWarning, stacklevel=2) # IPython's hint
|
|
194
|
+
assert e.value.code == 1
|
|
195
|
+
assert not [w for w in caught if "To exit" in str(w.message)]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bricksentry[databricks,mcp]==0.1.23
|
|
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
|
{bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_check_my_table.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
{bricksentry-0.1.23 → bricksentry-0.1.24}/examples/databricks/bricksentry_hr_walkthrough.ipynb
RENAMED
|
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
|
|
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
|
{bricksentry-0.1.23 → bricksentry-0.1.24}/templates/job-check/template/{{.project_name}}/.gitignore
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|