bricksentry 0.1.11__tar.gz → 0.1.12__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 (61) hide show
  1. {bricksentry-0.1.11 → bricksentry-0.1.12}/CHANGELOG.md +17 -0
  2. {bricksentry-0.1.11 → bricksentry-0.1.12}/PKG-INFO +29 -10
  3. {bricksentry-0.1.11 → bricksentry-0.1.12}/README.md +28 -9
  4. {bricksentry-0.1.11 → bricksentry-0.1.12}/pyproject.toml +1 -1
  5. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/__init__.py +1 -1
  6. bricksentry-0.1.12/src/bricksentry/__main__.py +6 -0
  7. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/agent_tools.py +20 -4
  8. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/assess.py +43 -4
  9. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/cli.py +1 -0
  10. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/config.py +1 -0
  11. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/explain.py +16 -0
  12. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/lineage.py +117 -3
  13. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/models.py +23 -0
  14. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/policy.py +55 -2
  15. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/policy_templates.py +8 -0
  16. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/report.py +15 -0
  17. bricksentry-0.1.12/tests/test_0112.py +244 -0
  18. {bricksentry-0.1.11 → bricksentry-0.1.12}/.gitignore +0 -0
  19. {bricksentry-0.1.11 → bricksentry-0.1.12}/CONTRIBUTING.md +0 -0
  20. {bricksentry-0.1.11 → bricksentry-0.1.12}/LICENSE +0 -0
  21. {bricksentry-0.1.11 → bricksentry-0.1.12}/SECURITY.md +0 -0
  22. {bricksentry-0.1.11 → bricksentry-0.1.12}/action.yml +0 -0
  23. {bricksentry-0.1.11 → bricksentry-0.1.12}/deploy/databricks-app/README.md +0 -0
  24. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/bricksentry.yml +0 -0
  25. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/bricksentry_check_my_table.ipynb +0 -0
  26. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/bricksentry_check_my_table.py +0 -0
  27. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/bricksentry_quickstart.ipynb +0 -0
  28. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/bricksentry_quickstart.py +0 -0
  29. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/github-workflow.yml +0 -0
  30. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/databricks/policy.yml +0 -0
  31. {bricksentry-0.1.11 → bricksentry-0.1.12}/examples/demo/agent_loop_demo.py +0 -0
  32. {bricksentry-0.1.11 → bricksentry-0.1.12}/packages/bricksentry-mcp/LICENSE +0 -0
  33. {bricksentry-0.1.11 → bricksentry-0.1.12}/packages/bricksentry-mcp/README.md +0 -0
  34. {bricksentry-0.1.11 → bricksentry-0.1.12}/packages/bricksentry-mcp/src/bricksentry_mcp/__init__.py +0 -0
  35. {bricksentry-0.1.11 → bricksentry-0.1.12}/scripts/build_notebook.py +0 -0
  36. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/backends/__init__.py +0 -0
  37. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/backends/base.py +0 -0
  38. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/backends/databricks_backend.py +0 -0
  39. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/backends/duckdb_backend.py +0 -0
  40. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/changes.py +0 -0
  41. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/demo.py +0 -0
  42. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/diff.py +0 -0
  43. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/github.py +0 -0
  44. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/mcp_server.py +0 -0
  45. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/measures.py +0 -0
  46. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/notify.py +0 -0
  47. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/preview.py +0 -0
  48. {bricksentry-0.1.11 → bricksentry-0.1.12}/src/bricksentry/py.typed +0 -0
  49. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/conftest.py +0 -0
  50. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_0110.py +0 -0
  51. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_018.py +0 -0
  52. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_019.py +0 -0
  53. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_assess_policy.py +0 -0
  54. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_check_notebook.py +0 -0
  55. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_databricks_and_uc.py +0 -0
  56. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_demo.py +0 -0
  57. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_diff.py +0 -0
  58. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_notebook.py +0 -0
  59. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_notify_templates.py +0 -0
  60. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_preview_agents.py +0 -0
  61. {bricksentry-0.1.11 → bricksentry-0.1.12}/tests/test_sample_guard_and_store.py +0 -0
@@ -1,7 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.12 (2026-11-11)
4
+
5
+ - **Column-level signals.** After the diff, bricksentry knows which columns a change touched (changed values, new NULLs, dropped or retyped). It reads their Unity Catalog tags from `information_schema.column_tags`, and follows `system.access.column_lineage` from those columns only, up to `lineage.column_depth` hops (default 2), to the downstream columns they feed. Assessments, summaries and the pull-request report show the changed columns, their tags and the column impact.
6
+ - New policy conditions: `changed_column_tag` (e.g. `pii`), `downstream_column_tag` (e.g. `certified`) and `changed_column` (glob). The default policy now asks a human when a column tagged `pii` changes (`pii-column-changed`); `strict`, `agent-safe` and `certified` also flag changes that feed a certified column (`certified-column-feed`), and `pii` flags changes that feed pii columns.
7
+ - `whats_downstream` takes an optional `columns` list, so an agent can see before editing which downstream columns a column feeds and how they are tagged.
8
+ - Static lineage (`type: static`) supports `column_edges` and `column_tags`; the README now shows a full static lineage example.
9
+ - `python -m bricksentry` runs the CLI, for environments where the console command isn't on the PATH.
10
+ - If column tags or column lineage can't be read, the check still runs and the summary says what was unavailable.
11
+
3
12
  ## 0.1.11 (2026-11-11)
4
13
 
14
+ > **Published by hand, without provenance.** GitHub Actions stopped starting jobs in this repository on 2026-11-11 (from about 20:20 UTC), so the release workflow could not run. `bricksentry` 0.1.11 was built from commit `b3d9c32` and uploaded manually with `twine`. That is why PyPI shows "loss of provenance" for this release: attestations are only created by the automated workflow. The 29 files inside the published wheel were compared with an independent build of the same commit and are identical. `bricksentry-mcp` was not published for 0.1.11. The next release goes through the normal workflow again, with provenance.
15
+ >
16
+ > SHA-256 of the published files:
17
+ > - `bricksentry-0.1.11-py3-none-any.whl`: `67f914626c71784d473693c8bbe72665b4de9a48c1265dbb1d1d0afe65cb76f1`
18
+ > - `bricksentry-0.1.11.tar.gz`: `6a894e20157734061850be33c1ca6af9dea160ba9f859babcc207939bc1c6913`
19
+ >
20
+ > Check a download with `shasum -a 256 <file>` (macOS) or `sha256sum <file>` (Linux).
21
+
5
22
  From a full live test of 0.1.9 on Databricks serverless:
6
23
 
7
24
  - Fix: when the Databricks SDK could not find credentials, the CLI showed the SDK's raw error. Run as a subprocess of a notebook it failed with a cryptic `parent_header` error. It now says it could not sign in to Databricks, lists the ways to provide credentials, and suggests the Python API inside notebooks.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bricksentry
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: Change-safety for Databricks 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
@@ -98,7 +98,7 @@ Before a change reaches production, bricksentry answers three questions, in a
98
98
  pull-request comment for humans and in structured JSON for agents:
99
99
 
100
100
  1. **What does it do to the data?** A key-based data diff: added, removed and changed rows, schema changes, per-column changes, numeric totals, duplicate keys, and *where* the change is concentrated ("100% of affected rows are region = APAC").
101
- 2. **Who gets hurt?** The downstream blast radius from Unity Catalog lineage: tables, jobs, notebooks, Lakeflow pipelines, dashboards and queries, with owners and tags.
101
+ 2. **Who gets hurt?** The downstream blast radius from Unity Catalog lineage: tables, jobs, notebooks, Lakeflow pipelines, dashboards and queries, with owners and tags. Down to the column: which columns the change touched, whether they are tagged (for example `pii`), and which downstream columns they feed.
102
102
  3. **Is it safe, and how do I undo it?** A deterministic policy verdict (`pass` · `warn` · `needs_human` · `block`) and the exact `RESTORE TABLE … VERSION AS OF n` rollback.
103
103
 
104
104
  For your Databricks workspace:
@@ -144,7 +144,7 @@ bricksentry is listed in the [official MCP Registry](https://registry.modelconte
144
144
 
145
145
  | Tool | What the agent gets |
146
146
  |---|---|
147
- | `whats_downstream(table, depth)` | Downstream assets with owners and tags. Call it *before* editing. |
147
+ | `whats_downstream(table, depth, columns?)` | Downstream assets with owners and tags. Call it *before* editing. Pass the columns you'll change to see the downstream columns they feed and their tags. |
148
148
  | `rollback_plan(table)` | The restore SQL. Capture it *before* changing anything. |
149
149
  | `preview_write(sql, target, keys?)` | Runs one write against a **disposable shallow clone**, never production, and returns the diff plus verdict. |
150
150
  | `assess_change(tables, candidates?, pr?)` | Diffs prod vs. the candidate built by your change, plus lineage and policy. Returns a verdict and an `id`. |
@@ -216,7 +216,7 @@ Check out with `fetch-depth: 0` and give the job `pull-requests: write` permissi
216
216
  Or use the bundled GitHub Action, which also writes the report to the job summary:
217
217
 
218
218
  ```yaml
219
- - uses: bricksentry/bricksentry@v0.1.11
219
+ - uses: bricksentry/bricksentry@v0.1.12
220
220
  with:
221
221
  config: bricksentry.yml
222
222
  fail-on: needs_human
@@ -241,7 +241,7 @@ jobs:
241
241
  fetch-depth: 0
242
242
  # Build this PR's version of your pipeline into a per-PR schema first,
243
243
  # for example: databricks bundle deploy -t ci && databricks bundle run -t ci
244
- - uses: bricksentry/bricksentry@v0.1.11
244
+ - uses: bricksentry/bricksentry@v0.1.12
245
245
  with:
246
246
  config: bricksentry.yml
247
247
  fail-on: needs_human
@@ -303,7 +303,7 @@ sandbox_schema: main.bricksentry_sandbox
303
303
  candidate_pattern: "{catalog}.{schema}_pr_{pr}.{table}"
304
304
  sample_pct: 10 # sample_guard re-checks the whole table (on by default)
305
305
  assessment_store: ~/.bricksentry/assessments # or false to keep assessments in memory
306
- lineage: {type: databricks, depth: 3, lookback_days: 90} # also: exclude, exclude_dropped
306
+ lineage: {type: databricks, depth: 3, lookback_days: 90, column_depth: 2} # also: exclude, exclude_dropped
307
307
  tables:
308
308
  main.sales.orders:
309
309
  keys: [order_id]
@@ -313,6 +313,23 @@ tables:
313
313
  policy: policy.yml # or builtin:<template>, see "Policy templates" below
314
314
  ```
315
315
 
316
+ **Without Unity Catalog** (local DuckDB work, tests, or other platforms), give the lineage in the config instead. Edges map a table to what reads from it; column edges and tags are optional:
317
+
318
+ ```yaml
319
+ lineage:
320
+ type: static
321
+ edges:
322
+ main.sales.orders: [main.sales.daily_revenue, "dashboard:Revenue Overview", "job:finance_close"]
323
+ owners:
324
+ main.sales.daily_revenue: finance-team
325
+ tags:
326
+ main.sales.daily_revenue: {certified: "true"}
327
+ column_edges: # "table.column" -> downstream "table.column"s
328
+ main.sales.orders.amount: [main.sales.daily_revenue.revenue]
329
+ column_tags: # table -> column -> tags
330
+ main.sales.orders: {customer_email: {pii: ""}}
331
+ ```
332
+
316
333
  Typos are caught: an unknown key such as `sample_pc` prints a warning that names the right one (`did you mean 'sample_pct'?`) instead of being silently ignored.
317
334
 
318
335
  **Which totals are checked.** `sum_change_pct_gt` rules and summaries look at measures: by default every numeric column except keys and columns whose names look like IDs, codes, years and other date parts, coordinates, ratings, scores or rates (a 10% drop in `sum(established_year)` only says rows were removed). List `measures` for a table to choose exactly, or set `measures: all` to check every numeric column. A rule that names a column (`when: {column: rating, sum_change_pct_gt: 1}`) always checks it.
@@ -365,7 +382,9 @@ Use one directly with `policy: builtin:finance`, or write an editable copy with
365
382
 
366
383
  ### Policy conditions
367
384
 
368
- `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`) · `any_change` · `diff_error` · `lineage_error`
385
+ `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`
386
+
387
+ **Column conditions** look only at the columns the change touched (changed values, new NULLs, dropped or retyped): `changed_column_tag: pii` matches when one of them is tagged `pii` in Unity Catalog, and `downstream_column_tag: certified` when one of them feeds a column tagged `certified`, following `system.access.column_lineage` up to `lineage.column_depth` hops (default 2; `0` turns it off). The default policy asks a human when a `pii` column changes; `strict`, `agent-safe` and `certified` also flag changes that feed certified columns.
369
388
 
370
389
  All conditions in a `when` must hold. The most severe matching rule sets the verdict. Unknown conditions are rejected at load time, so a typo can't silently disable a rule.
371
390
 
@@ -373,12 +392,12 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
373
392
 
374
393
  - `CAN USE` on a SQL warehouse.
375
394
  - `SELECT` on the tables you assess and their candidates.
376
- - `SELECT` on `system.access.table_lineage`, plus `system.information_schema` for owners and tags. Without lineage access bricksentry still diffs, and adds a `lineage-unavailable` warning (blast radius unknown) instead of guessing.
395
+ - `SELECT` on `system.access.table_lineage` (and `system.access.column_lineage` for column-level impact), plus `system.information_schema` for owners, table tags and column tags. Without lineage access bricksentry still diffs, and adds a `lineage-unavailable` warning (blast radius unknown) instead of guessing.
377
396
  - `CREATE TABLE` on `sandbox_schema`, for `preview_write`.
378
397
 
379
398
  ## Known limits (v0.1.x)
380
399
 
381
- - **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.
400
+ - **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.
382
401
  - **Keys are required.** Tables without a stable key can't be diffed row by row yet (an aggregate-profile mode is planned).
383
402
  - **Changed-table detection uses path globs** from config. It doesn't parse Asset Bundles yet.
384
403
  - **Validated on one Databricks workspace so far** (serverless, November 2026, on a 2-million-row table with 0.1.4): lineage, Delta rollback plans, previews on shallow clones, every verdict level, and the sampling guard catching a single changed row. 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.
@@ -387,7 +406,7 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
387
406
 
388
407
  **Top priority: validation across more workspaces.** Classic and serverless compute, AWS, Azure and GCP, and workspaces with restricted system-table access. If you run the quickstart notebook, please [share what you see](https://github.com/bricksentry/bricksentry/issues), whether it works or not.
389
408
 
390
- Next: dbt support, so dbt models on Databricks get the same diff, blast radius and verdict (planned for 0.2) · Asset Bundle parsing for automatic table detection · column-level blast radius from `system.access.column_lineage` · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
409
+ Next: dbt support, so dbt models on Databricks get the same diff, blast radius and verdict (planned for 0.2) · Asset Bundle parsing for automatic table detection · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
391
410
 
392
411
  ## Contributing
393
412
 
@@ -51,7 +51,7 @@ Before a change reaches production, bricksentry answers three questions, in a
51
51
  pull-request comment for humans and in structured JSON for agents:
52
52
 
53
53
  1. **What does it do to the data?** A key-based data diff: added, removed and changed rows, schema changes, per-column changes, numeric totals, duplicate keys, and *where* the change is concentrated ("100% of affected rows are region = APAC").
54
- 2. **Who gets hurt?** The downstream blast radius from Unity Catalog lineage: tables, jobs, notebooks, Lakeflow pipelines, dashboards and queries, with owners and tags.
54
+ 2. **Who gets hurt?** The downstream blast radius from Unity Catalog lineage: tables, jobs, notebooks, Lakeflow pipelines, dashboards and queries, with owners and tags. Down to the column: which columns the change touched, whether they are tagged (for example `pii`), and which downstream columns they feed.
55
55
  3. **Is it safe, and how do I undo it?** A deterministic policy verdict (`pass` · `warn` · `needs_human` · `block`) and the exact `RESTORE TABLE … VERSION AS OF n` rollback.
56
56
 
57
57
  For your Databricks workspace:
@@ -97,7 +97,7 @@ bricksentry is listed in the [official MCP Registry](https://registry.modelconte
97
97
 
98
98
  | Tool | What the agent gets |
99
99
  |---|---|
100
- | `whats_downstream(table, depth)` | Downstream assets with owners and tags. Call it *before* editing. |
100
+ | `whats_downstream(table, depth, columns?)` | Downstream assets with owners and tags. Call it *before* editing. Pass the columns you'll change to see the downstream columns they feed and their tags. |
101
101
  | `rollback_plan(table)` | The restore SQL. Capture it *before* changing anything. |
102
102
  | `preview_write(sql, target, keys?)` | Runs one write against a **disposable shallow clone**, never production, and returns the diff plus verdict. |
103
103
  | `assess_change(tables, candidates?, pr?)` | Diffs prod vs. the candidate built by your change, plus lineage and policy. Returns a verdict and an `id`. |
@@ -169,7 +169,7 @@ Check out with `fetch-depth: 0` and give the job `pull-requests: write` permissi
169
169
  Or use the bundled GitHub Action, which also writes the report to the job summary:
170
170
 
171
171
  ```yaml
172
- - uses: bricksentry/bricksentry@v0.1.11
172
+ - uses: bricksentry/bricksentry@v0.1.12
173
173
  with:
174
174
  config: bricksentry.yml
175
175
  fail-on: needs_human
@@ -194,7 +194,7 @@ jobs:
194
194
  fetch-depth: 0
195
195
  # Build this PR's version of your pipeline into a per-PR schema first,
196
196
  # for example: databricks bundle deploy -t ci && databricks bundle run -t ci
197
- - uses: bricksentry/bricksentry@v0.1.11
197
+ - uses: bricksentry/bricksentry@v0.1.12
198
198
  with:
199
199
  config: bricksentry.yml
200
200
  fail-on: needs_human
@@ -256,7 +256,7 @@ sandbox_schema: main.bricksentry_sandbox
256
256
  candidate_pattern: "{catalog}.{schema}_pr_{pr}.{table}"
257
257
  sample_pct: 10 # sample_guard re-checks the whole table (on by default)
258
258
  assessment_store: ~/.bricksentry/assessments # or false to keep assessments in memory
259
- lineage: {type: databricks, depth: 3, lookback_days: 90} # also: exclude, exclude_dropped
259
+ lineage: {type: databricks, depth: 3, lookback_days: 90, column_depth: 2} # also: exclude, exclude_dropped
260
260
  tables:
261
261
  main.sales.orders:
262
262
  keys: [order_id]
@@ -266,6 +266,23 @@ tables:
266
266
  policy: policy.yml # or builtin:<template>, see "Policy templates" below
267
267
  ```
268
268
 
269
+ **Without Unity Catalog** (local DuckDB work, tests, or other platforms), give the lineage in the config instead. Edges map a table to what reads from it; column edges and tags are optional:
270
+
271
+ ```yaml
272
+ lineage:
273
+ type: static
274
+ edges:
275
+ main.sales.orders: [main.sales.daily_revenue, "dashboard:Revenue Overview", "job:finance_close"]
276
+ owners:
277
+ main.sales.daily_revenue: finance-team
278
+ tags:
279
+ main.sales.daily_revenue: {certified: "true"}
280
+ column_edges: # "table.column" -> downstream "table.column"s
281
+ main.sales.orders.amount: [main.sales.daily_revenue.revenue]
282
+ column_tags: # table -> column -> tags
283
+ main.sales.orders: {customer_email: {pii: ""}}
284
+ ```
285
+
269
286
  Typos are caught: an unknown key such as `sample_pc` prints a warning that names the right one (`did you mean 'sample_pct'?`) instead of being silently ignored.
270
287
 
271
288
  **Which totals are checked.** `sum_change_pct_gt` rules and summaries look at measures: by default every numeric column except keys and columns whose names look like IDs, codes, years and other date parts, coordinates, ratings, scores or rates (a 10% drop in `sum(established_year)` only says rows were removed). List `measures` for a table to choose exactly, or set `measures: all` to check every numeric column. A rule that names a column (`when: {column: rating, sum_change_pct_gt: 1}`) always checks it.
@@ -318,7 +335,9 @@ Use one directly with `policy: builtin:finance`, or write an editable copy with
318
335
 
319
336
  ### Policy conditions
320
337
 
321
- `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`) · `any_change` · `diff_error` · `lineage_error`
338
+ `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`
339
+
340
+ **Column conditions** look only at the columns the change touched (changed values, new NULLs, dropped or retyped): `changed_column_tag: pii` matches when one of them is tagged `pii` in Unity Catalog, and `downstream_column_tag: certified` when one of them feeds a column tagged `certified`, following `system.access.column_lineage` up to `lineage.column_depth` hops (default 2; `0` turns it off). The default policy asks a human when a `pii` column changes; `strict`, `agent-safe` and `certified` also flag changes that feed certified columns.
322
341
 
323
342
  All conditions in a `when` must hold. The most severe matching rule sets the verdict. Unknown conditions are rejected at load time, so a typo can't silently disable a rule.
324
343
 
@@ -326,12 +345,12 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
326
345
 
327
346
  - `CAN USE` on a SQL warehouse.
328
347
  - `SELECT` on the tables you assess and their candidates.
329
- - `SELECT` on `system.access.table_lineage`, plus `system.information_schema` for owners and tags. Without lineage access bricksentry still diffs, and adds a `lineage-unavailable` warning (blast radius unknown) instead of guessing.
348
+ - `SELECT` on `system.access.table_lineage` (and `system.access.column_lineage` for column-level impact), plus `system.information_schema` for owners, table tags and column tags. Without lineage access bricksentry still diffs, and adds a `lineage-unavailable` warning (blast radius unknown) instead of guessing.
330
349
  - `CREATE TABLE` on `sandbox_schema`, for `preview_write`.
331
350
 
332
351
  ## Known limits (v0.1.x)
333
352
 
334
- - **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.
353
+ - **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.
335
354
  - **Keys are required.** Tables without a stable key can't be diffed row by row yet (an aggregate-profile mode is planned).
336
355
  - **Changed-table detection uses path globs** from config. It doesn't parse Asset Bundles yet.
337
356
  - **Validated on one Databricks workspace so far** (serverless, November 2026, on a 2-million-row table with 0.1.4): lineage, Delta rollback plans, previews on shallow clones, every verdict level, and the sampling guard catching a single changed row. 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.
@@ -340,7 +359,7 @@ All conditions in a `when` must hold. The most severe matching rule sets the ver
340
359
 
341
360
  **Top priority: validation across more workspaces.** Classic and serverless compute, AWS, Azure and GCP, and workspaces with restricted system-table access. If you run the quickstart notebook, please [share what you see](https://github.com/bricksentry/bricksentry/issues), whether it works or not.
342
361
 
343
- Next: dbt support, so dbt models on Databricks get the same diff, blast radius and verdict (planned for 0.2) · Asset Bundle parsing for automatic table detection · column-level blast radius from `system.access.column_lineage` · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
362
+ Next: dbt support, so dbt models on Databricks get the same diff, blast radius and verdict (planned for 0.2) · Asset Bundle parsing for automatic table detection · an aggregate diff for keyless tables · Lakeflow expectations in the verdict · `bricksentry watch` for scheduled drift checks · a Databricks App UI.
344
363
 
345
364
  ## Contributing
346
365
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bricksentry"
7
- version = "0.1.11"
7
+ version = "0.1.12"
8
8
  description = "Change-safety for Databricks 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"
@@ -23,4 +23,4 @@ __all__ = [
23
23
  "TableDiff",
24
24
  "Verdict",
25
25
  ]
26
- __version__ = "0.1.11"
26
+ __version__ = "0.1.12"
@@ -0,0 +1,6 @@
1
+ """Run the CLI with ``python -m bricksentry`` (same as the ``bricksentry`` command)."""
2
+
3
+ from bricksentry.cli import entry
4
+
5
+ if __name__ == "__main__": # pragma: no cover
6
+ entry()
@@ -56,27 +56,42 @@ def _safe(fn):
56
56
  def whats_downstream(
57
57
  table: Annotated[str, _desc("Fully qualified table name, e.g. main.sales.orders.")],
58
58
  depth: Annotated[int, _desc("How many lineage hops to follow downstream (default 3).")] = 3,
59
+ columns: Annotated[
60
+ list[str] | None,
61
+ _desc("Optional columns you plan to change, e.g. ['email']. Adds the downstream columns they feed, "
62
+ "with their tags, and the tags on these columns."),
63
+ ] = None,
59
64
  ) -> dict[str, Any]:
60
65
  """List what depends on a table, so you know the blast radius BEFORE you edit it.
61
66
 
62
67
  Use this first, when planning a change. It reads Unity Catalog lineage and
63
68
  returns every downstream table, job, notebook, pipeline, dashboard and query,
64
69
  up to `depth` hops, with owners and tags. Dropped tables are filtered out.
65
- Read-only; changes nothing. To check a change you have already made, use
66
- assess_change instead.
70
+ Pass `columns` when you will change specific columns to see the downstream
71
+ columns they feed (column lineage) and whether any carry tags such as pii or
72
+ certified. Read-only; changes nothing. To check a change you have already
73
+ made, use assess_change instead.
67
74
 
68
75
  Returns {table, owner, tags, count, downstream: [{kind, name, depth, via,
69
- owner, tags}]}, or {error} if the table or lineage cannot be read."""
76
+ owner, tags}]}, plus {column_tags, column_downstream: [{source_column, table,
77
+ column, depth, tags}]} when `columns` is given, or {error} if the table or
78
+ lineage cannot be read."""
70
79
  s = get_sentry()
71
80
  nodes = s.downstream(table, depth)
72
81
  owner, tags = s.lineage.owner_and_tags(table)
73
- return {
82
+ out: dict[str, Any] = {
74
83
  "table": table,
75
84
  "owner": owner,
76
85
  "tags": tags,
77
86
  "count": len(nodes),
78
87
  "downstream": [n.to_dict() for n in nodes],
79
88
  }
89
+ if columns:
90
+ col_tags = s.lineage.column_tags(table)
91
+ out["column_tags"] = {c: col_tags[c] for c in columns if col_tags.get(c)}
92
+ feeds = s.lineage.column_downstream(table, list(columns), int(s.config.lineage.get("column_depth", 2)))
93
+ out["column_downstream"] = [c.to_dict() for c in feeds]
94
+ return out
80
95
 
81
96
 
82
97
  @_safe
@@ -103,6 +118,7 @@ def assess_change(
103
118
 
104
119
  Returns {id, verdict: pass|warn|needs_human|block, risk_tier, safe_to_ship,
105
120
  notify, rule_hits, tables: [{table, verdict, summary, diff, downstream,
121
+ changed_columns, column_tags, column_downstream,
106
122
  rollback}]}. Pass `id` to safe_to_ship (and optionally explain_diff)."""
107
123
  a = get_sentry().assess(list(tables), candidates=candidates, pr=pr)
108
124
  return a.to_dict()
@@ -10,10 +10,10 @@ from typing import Any
10
10
  from bricksentry.backends.base import Backend, make_backend
11
11
  from bricksentry.config import Config
12
12
  from bricksentry.diff import diff_tables
13
- from bricksentry.explain import explain_diff, explain_impact
13
+ from bricksentry.explain import explain_columns, explain_diff, explain_impact
14
14
  from bricksentry.lineage import LineageProvider, make_lineage
15
15
  from bricksentry.models import Assessment, ImpactNode, TableAssessment, TableDiff, Verdict
16
- from bricksentry.policy import Policy
16
+ from bricksentry.policy import ColumnContext, Policy
17
17
  from bricksentry.preview import rewrite_for_preview, sandbox_name
18
18
 
19
19
 
@@ -104,13 +104,14 @@ class Sentry:
104
104
  lineage_err = _first_line(e)
105
105
  owner, tags = self.lineage.owner_and_tags(table)
106
106
  measures = self.config.spec(table).measures
107
+ cols, col_note = self._column_context(table, diff)
107
108
  verdict, hits = self.policy.evaluate(
108
- table, diff, nodes, tags, diff_error=err, measures=measures, lineage_error=lineage_err
109
+ table, diff, nodes, tags, diff_error=err, measures=measures, lineage_error=lineage_err, columns=cols
109
110
  )
110
111
  summary = (explain_diff(diff, measures) if diff else f"{table}: diff unavailable ({err}).") + " " + (
111
112
  f"{table}: blast radius unknown, lineage lookup failed ({lineage_err})."
112
113
  if lineage_err else explain_impact(table, nodes)
113
- )
114
+ ) + explain_columns(cols, col_note)
114
115
  ta = TableAssessment(
115
116
  table=table,
116
117
  diff=diff,
@@ -121,6 +122,9 @@ class Sentry:
121
122
  verdict=verdict,
122
123
  hits=hits,
123
124
  summary=summary,
125
+ changed_columns=cols.changed,
126
+ column_tags={c: cols.tags[c] for c in cols.changed if cols.tags.get(c)},
127
+ column_downstream=cols.downstream,
124
128
  )
125
129
  results.append(ta)
126
130
  if verdict.rank >= self.policy.notify_on.rank:
@@ -139,6 +143,27 @@ class Sentry:
139
143
  self._save(a)
140
144
  return a
141
145
 
146
+ def _column_context(self, table: str, diff: TableDiff | None) -> tuple[ColumnContext, str | None]:
147
+ """Which columns changed, their tags, and the downstream columns they feed.
148
+ Lookups that fail leave that part empty and return a one-line note."""
149
+ changed = changed_columns(diff)
150
+ if not changed:
151
+ return ColumnContext(), None
152
+ notes: list[str] = []
153
+ col_tags: dict[str, dict[str, str]] = {}
154
+ feeds: list = []
155
+ try:
156
+ col_tags = self.lineage.column_tags(table)
157
+ except Exception as e: # e.g. no access to information_schema.column_tags
158
+ notes.append(f"column tags unavailable ({_first_line(e)})")
159
+ try:
160
+ depth = int(self.config.lineage.get("column_depth", 2))
161
+ if depth > 0:
162
+ feeds = self.lineage.column_downstream(table, changed, depth)
163
+ except Exception as e: # e.g. no SELECT on system.access.column_lineage
164
+ notes.append(f"column lineage unavailable ({_first_line(e)})")
165
+ return ColumnContext(changed, col_tags, feeds), "; ".join(notes) or None
166
+
142
167
  # --- saved assessments -------------------------------------------------
143
168
  def _save(self, a: Assessment) -> None:
144
169
  """Save an assessment as JSON so another Sentry (another process, the MCP
@@ -216,3 +241,17 @@ def _first_line(e: Exception, limit: int = 200) -> str:
216
241
  """A short, single-line error for verdict reasons and alerts."""
217
242
  text = (str(e).strip().splitlines() or [type(e).__name__])[0]
218
243
  return text if len(text) <= limit else text[: limit - 1] + "…"
244
+
245
+
246
+ def changed_columns(diff: TableDiff | None) -> list[str]:
247
+ """Columns a change touched: changed values, dropped or retyped, or new NULLs."""
248
+ if diff is None or diff.error:
249
+ return []
250
+ out: list[str] = []
251
+ for c in diff.columns:
252
+ if c.changed_rows or (
253
+ c.base_nulls is not None and c.candidate_nulls is not None and c.candidate_nulls > c.base_nulls
254
+ ):
255
+ out.append(c.column)
256
+ out += list(diff.schema.removed) + list(diff.schema.type_changed)
257
+ return list(dict.fromkeys(out))
@@ -268,6 +268,7 @@ rules:
268
268
  - {name: type-change, when: {column_type_changed: true}, then: warn}
269
269
  - {name: certified-downstream, when: {downstream_tag: certified}, then: needs_human}
270
270
  - {name: pii-table, when: {tag: pii}, then: needs_human}
271
+ - {name: pii-column-changed, when: {changed_column_tag: pii}, then: needs_human}
271
272
  - {name: row-loss, when: {removed_pct_gt: 1}, then: needs_human}
272
273
  - {name: many-rows-changed, when: {changed_pct_gt: 10}, then: warn}
273
274
  - {name: numeric-total-moved, when: {sum_change_pct_gt: 5}, then: warn}
@@ -48,6 +48,7 @@ NOTIFY_KEYS = {"on", "slack_webhook", "teams_webhook", "mentions", "run_url"}
48
48
  LINEAGE_KEYS = {
49
49
  "type", "depth", "lookback_days", "lineage_table", "tables_table", "tags_table", "max_nodes",
50
50
  "exclude", "exclude_dropped", "edges", "owners", "tags",
51
+ "column_depth", "column_lineage_table", "column_tags_table", "column_edges", "column_tags",
51
52
  }
52
53
 
53
54
 
@@ -98,3 +98,19 @@ def explain_impact(table: str, nodes: list[ImpactNode]) -> str:
98
98
  if owners:
99
99
  s += f"; owners: {', '.join(owners[:5])}"
100
100
  return s + "."
101
+
102
+
103
+ def explain_columns(cols, note: str | None = None) -> str:
104
+ """One sentence on column-level facts, or "" when there's nothing to say.
105
+ ``cols`` is a policy.ColumnContext."""
106
+ parts = []
107
+ tagged = [f"{c} ({', '.join(cols.tags[c])})" for c in cols.changed if cols.tags.get(c)]
108
+ if tagged:
109
+ parts.append("Tagged columns changed: " + ", ".join(tagged[:5]))
110
+ if cols.downstream:
111
+ shown = ", ".join(f"{d.table}.{d.column}" for d in cols.downstream[:3])
112
+ more = f" and {len(cols.downstream) - 3} more" if len(cols.downstream) > 3 else ""
113
+ parts.append(f"Changed columns feed {len(cols.downstream)} downstream column(s): {shown}{more}")
114
+ if note:
115
+ parts.append(note[:1].upper() + note[1:])
116
+ return (" " + ". ".join(parts) + ".") if parts else ""
@@ -14,7 +14,7 @@ from abc import ABC, abstractmethod
14
14
  from typing import Any
15
15
 
16
16
  from bricksentry.backends.base import Backend
17
- from bricksentry.models import ImpactNode
17
+ from bricksentry.models import ColumnImpact, ImpactNode
18
18
 
19
19
  _ENTITY_KINDS = {
20
20
  "NOTEBOOK": "notebook",
@@ -37,6 +37,14 @@ class LineageProvider(ABC):
37
37
  def owner_and_tags(self, table: str) -> tuple[str | None, dict[str, str]]:
38
38
  return None, {}
39
39
 
40
+ def column_tags(self, table: str) -> dict[str, dict[str, str]]:
41
+ """Tags on the table's columns: {column: {tag: value}}. Empty if unknown."""
42
+ return {}
43
+
44
+ def column_downstream(self, table: str, columns: list[str], depth: int = 2) -> list[ColumnImpact]:
45
+ """Downstream columns fed by ``columns`` of ``table``, with their tags."""
46
+ return []
47
+
40
48
 
41
49
  class StaticLineage(LineageProvider):
42
50
  """Lineage from config::
@@ -49,12 +57,25 @@ class StaticLineage(LineageProvider):
49
57
  main.sales.daily_revenue: finance-team
50
58
  tags:
51
59
  main.sales.daily_revenue: {certified: "true"}
60
+ column_edges: # "table.column" -> downstream "table.column"s
61
+ main.sales.orders.amount: [main.sales.daily_revenue.revenue]
62
+ column_tags: # table -> column -> tags
63
+ main.sales.orders: {email: {pii: ""}}
52
64
  """
53
65
 
54
- def __init__(self, edges: dict[str, list[str]] | None = None, owners: dict | None = None, tags: dict | None = None):
66
+ def __init__(
67
+ self,
68
+ edges: dict[str, list[str]] | None = None,
69
+ owners: dict | None = None,
70
+ tags: dict | None = None,
71
+ column_edges: dict[str, list[str]] | None = None,
72
+ column_tags: dict | None = None,
73
+ ):
55
74
  self.edges = edges or {}
56
75
  self.owners = owners or {}
57
76
  self.tags = tags or {}
77
+ self.column_edges = {k.lower(): v for k, v in (column_edges or {}).items()}
78
+ self.col_tags = {t.lower(): v for t, v in (column_tags or {}).items()}
58
79
 
59
80
  def downstream(self, table: str, depth: int = 3) -> list[ImpactNode]:
60
81
  out: list[ImpactNode] = []
@@ -88,6 +109,27 @@ class StaticLineage(LineageProvider):
88
109
  def owner_and_tags(self, table: str) -> tuple[str | None, dict[str, str]]:
89
110
  return self.owners.get(table), {str(k): str(v) for k, v in (self.tags.get(table) or {}).items()}
90
111
 
112
+ def column_tags(self, table: str) -> dict[str, dict[str, str]]:
113
+ cols = self.col_tags.get(table.lower()) or {}
114
+ return {str(c): {str(k): "" if v is None else str(v) for k, v in (t or {}).items()} for c, t in cols.items()}
115
+
116
+ def column_downstream(self, table: str, columns: list[str], depth: int = 2) -> list[ColumnImpact]:
117
+ out: list[ColumnImpact] = []
118
+ seen: set[str] = set()
119
+ frontier = [(c, f"{table}.{c}") for c in columns]
120
+ for d in range(1, depth + 1):
121
+ nxt = []
122
+ for source_col, ref in frontier:
123
+ for tgt in self.column_edges.get(ref.lower(), []):
124
+ if tgt.lower() in seen:
125
+ continue
126
+ seen.add(tgt.lower())
127
+ t_table, _, t_col = tgt.rpartition(".")
128
+ out.append(ColumnImpact(source_col, t_table, t_col, d, self.column_tags(t_table).get(t_col, {})))
129
+ nxt.append((source_col, tgt))
130
+ frontier = nxt
131
+ return out
132
+
91
133
 
92
134
  def _parse_static(s: str) -> tuple[str, str]:
93
135
  if ":" in s and not s.startswith(("http:", "https:")):
@@ -120,6 +162,8 @@ class UnityCatalogLineage(LineageProvider):
120
162
  max_nodes: int = 500,
121
163
  exclude_patterns: list[str] | None = None,
122
164
  exclude_dropped: bool = True,
165
+ column_lineage_table: str = "system.access.column_lineage",
166
+ column_tags_table: str = "system.information_schema.column_tags",
123
167
  ):
124
168
  self.backend = backend
125
169
  self.lookback_days = lookback_days
@@ -129,6 +173,9 @@ class UnityCatalogLineage(LineageProvider):
129
173
  self.max_nodes = max_nodes
130
174
  self.exclude_patterns = [p.lower() for p in (exclude_patterns if exclude_patterns is not None else DEFAULT_EXCLUDE)]
131
175
  self.exclude_dropped = exclude_dropped
176
+ self.column_lineage_table = column_lineage_table
177
+ self.column_tags_table = column_tags_table
178
+ self._col_tag_cache: dict[str, dict[str, dict[str, str]]] = {}
132
179
  self._meta_cache: dict[str, tuple[str | None, dict[str, str]]] = {}
133
180
  self._exists: dict[str, bool] = {} # True / False when information_schema answered; absent if unknown
134
181
 
@@ -222,6 +269,69 @@ class UnityCatalogLineage(LineageProvider):
222
269
  pass
223
270
 
224
271
 
272
+ # --- column level -------------------------------------------------------------
273
+ def column_tags(self, table: str) -> dict[str, dict[str, str]]:
274
+ if table.lower() not in self._col_tag_cache:
275
+ self._load_column_tags([table])
276
+ return self._col_tag_cache.get(table.lower(), {})
277
+
278
+ def _load_column_tags(self, tables: list[str]) -> None:
279
+ """Raises if information_schema can't be read; callers decide how to degrade."""
280
+ for t in tables:
281
+ self._col_tag_cache.setdefault(t.lower(), {})
282
+ full = "lower(concat_ws('.', catalog_name, schema_name, table_name))"
283
+ for i in range(0, len(tables), 200):
284
+ in_list = ", ".join(_lit(t.lower()) for t in tables[i : i + 200])
285
+ for r in self.backend.query(
286
+ f"SELECT {full} AS fqn, column_name, tag_name, tag_value FROM {self.column_tags_table} "
287
+ f"WHERE {full} IN ({in_list})"
288
+ ):
289
+ cols = self._col_tag_cache.setdefault(r["fqn"], {})
290
+ cols.setdefault(str(r["column_name"]), {})[str(r["tag_name"])] = (
291
+ "" if r.get("tag_value") is None else str(r["tag_value"])
292
+ )
293
+
294
+ def column_downstream(self, table: str, columns: list[str], depth: int = 2) -> list[ColumnImpact]:
295
+ """Breadth-first over ``system.access.column_lineage``, starting from the changed
296
+ columns only, one query per level. Raises if the lineage table can't be read."""
297
+ out: list[ColumnImpact] = []
298
+ origin: dict[str, str] = {f"{table}.{c}".lower(): c for c in columns}
299
+ seen = set(origin)
300
+ frontier = list(origin)
301
+ src = "lower(concat_ws('.', source_table_full_name, source_column_name))"
302
+ for d in range(1, depth + 1):
303
+ if not frontier or len(out) >= self.max_nodes:
304
+ break
305
+ in_list = ", ".join(_lit(f) for f in frontier)
306
+ rows = self.backend.query(
307
+ f"SELECT DISTINCT {src} AS src, target_table_full_name AS tgt_table, target_column_name AS tgt_col "
308
+ f"FROM {self.column_lineage_table} WHERE {src} IN ({in_list}) "
309
+ f"AND target_table_full_name IS NOT NULL AND target_column_name IS NOT NULL "
310
+ f"AND event_date >= {self.backend.days_ago(self.lookback_days)}"
311
+ )
312
+ nxt = []
313
+ for r in rows:
314
+ t_table, t_col = str(r["tgt_table"]), str(r["tgt_col"])
315
+ key = f"{t_table}.{t_col}".lower()
316
+ if key in seen or self._excluded(t_table):
317
+ continue
318
+ seen.add(key)
319
+ origin[key] = origin.get(str(r["src"]).lower(), str(r["src"]).rpartition(".")[2])
320
+ out.append(ColumnImpact(origin[key], t_table, t_col, d))
321
+ nxt.append(key)
322
+ frontier = nxt
323
+ out = out[: self.max_nodes]
324
+ tables = sorted({c.table for c in out})
325
+ if tables:
326
+ try:
327
+ self._load_column_tags(tables)
328
+ except Exception:
329
+ pass # tags are extra detail; the lineage itself stands
330
+ for c in out:
331
+ c.tags = self._col_tag_cache.get(c.table.lower(), {}).get(c.column, {})
332
+ return out
333
+
334
+
225
335
  DEFAULT_EXCLUDE = ["*__preview_*"] # bricksentry's own preview_write clones
226
336
 
227
337
 
@@ -237,7 +347,9 @@ def make_lineage(cfg: dict[str, Any] | None, backend: Backend) -> LineageProvide
237
347
  cfg = dict(cfg or {})
238
348
  kind = cfg.get("type") or ("databricks" if backend.name == "databricks" else "static")
239
349
  if kind == "static":
240
- return StaticLineage(cfg.get("edges"), cfg.get("owners"), cfg.get("tags"))
350
+ return StaticLineage(
351
+ cfg.get("edges"), cfg.get("owners"), cfg.get("tags"), cfg.get("column_edges"), cfg.get("column_tags")
352
+ )
241
353
  if kind in ("databricks", "unity_catalog", "uc"):
242
354
  return UnityCatalogLineage(
243
355
  backend,
@@ -248,5 +360,7 @@ def make_lineage(cfg: dict[str, Any] | None, backend: Backend) -> LineageProvide
248
360
  max_nodes=int(cfg.get("max_nodes", 500)),
249
361
  exclude_patterns=cfg.get("exclude"),
250
362
  exclude_dropped=bool(cfg.get("exclude_dropped", True)),
363
+ column_lineage_table=cfg.get("column_lineage_table", "system.access.column_lineage"),
364
+ column_tags_table=cfg.get("column_tags_table", "system.information_schema.column_tags"),
251
365
  )
252
366
  raise ValueError(f"Unknown lineage type {kind!r}")