dbt-features 0.3.0__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 (79) hide show
  1. dbt_features-0.3.0/.gitignore +25 -0
  2. dbt_features-0.3.0/CHANGELOG.md +136 -0
  3. dbt_features-0.3.0/LICENSE +190 -0
  4. dbt_features-0.3.0/PKG-INFO +332 -0
  5. dbt_features-0.3.0/README.md +93 -0
  6. dbt_features-0.3.0/dbt_package/README.md +61 -0
  7. dbt_features-0.3.0/dbt_package/dbt_project.yml +9 -0
  8. dbt_features-0.3.0/dbt_package/macros/validate.sql +63 -0
  9. dbt_features-0.3.0/docs/dbt-package.md +12 -0
  10. dbt_features-0.3.0/docs/deploy.md +71 -0
  11. dbt_features-0.3.0/docs/enrichment.md +233 -0
  12. dbt_features-0.3.0/docs/schema.md +95 -0
  13. dbt_features-0.3.0/docs/screenshots/catalog-index-demo.png +0 -0
  14. dbt_features-0.3.0/examples/jaffle_shop_features/.user.yml +1 -0
  15. dbt_features-0.3.0/examples/jaffle_shop_features/README.md +35 -0
  16. dbt_features-0.3.0/examples/jaffle_shop_features/dbt_project.yml +15 -0
  17. dbt_features-0.3.0/examples/jaffle_shop_features/models/features/_features.yml +51 -0
  18. dbt_features-0.3.0/examples/jaffle_shop_features/models/features/customer_features_daily.sql +20 -0
  19. dbt_features-0.3.0/examples/jaffle_shop_features/models/features/customer_features_lifetime.sql +5 -0
  20. dbt_features-0.3.0/examples/jaffle_shop_features/models/metrics/consumer_dashboard_metrics.sql +5 -0
  21. dbt_features-0.3.0/examples/jaffle_shop_features/models/staging/stg_orders.sql +6 -0
  22. dbt_features-0.3.0/examples/jaffle_shop_features/profiles.yml +7 -0
  23. dbt_features-0.3.0/examples/jaffle_shop_features/seeds/raw_orders.csv +9 -0
  24. dbt_features-0.3.0/pyproject.toml +92 -0
  25. dbt_features-0.3.0/src/dbt_features/__init__.py +16 -0
  26. dbt_features-0.3.0/src/dbt_features/__main__.py +4 -0
  27. dbt_features-0.3.0/src/dbt_features/catalog.py +237 -0
  28. dbt_features-0.3.0/src/dbt_features/cli.py +560 -0
  29. dbt_features-0.3.0/src/dbt_features/demo/__init__.py +15 -0
  30. dbt_features-0.3.0/src/dbt_features/demo/manifest.json +319 -0
  31. dbt_features-0.3.0/src/dbt_features/enrichment/__init__.py +25 -0
  32. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/__init__.py +72 -0
  33. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/_dbapi.py +116 -0
  34. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/bigquery.py +212 -0
  35. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/duckdb.py +141 -0
  36. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/postgres.py +115 -0
  37. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/redshift.py +143 -0
  38. dbt_features-0.3.0/src/dbt_features/enrichment/adapters/snowflake.py +192 -0
  39. dbt_features-0.3.0/src/dbt_features/enrichment/cache.py +126 -0
  40. dbt_features-0.3.0/src/dbt_features/enrichment/engine.py +66 -0
  41. dbt_features-0.3.0/src/dbt_features/enrichment/exceptions.py +12 -0
  42. dbt_features-0.3.0/src/dbt_features/enrichment/format.py +116 -0
  43. dbt_features-0.3.0/src/dbt_features/enrichment/models.py +54 -0
  44. dbt_features-0.3.0/src/dbt_features/enrichment/profiles.py +159 -0
  45. dbt_features-0.3.0/src/dbt_features/inference.py +118 -0
  46. dbt_features-0.3.0/src/dbt_features/parser.py +322 -0
  47. dbt_features-0.3.0/src/dbt_features/py.typed +0 -0
  48. dbt_features-0.3.0/src/dbt_features/renderer.py +699 -0
  49. dbt_features-0.3.0/src/dbt_features/schema.py +178 -0
  50. dbt_features-0.3.0/src/dbt_features/static/favicon.svg +6 -0
  51. dbt_features-0.3.0/src/dbt_features/static/filter.js +128 -0
  52. dbt_features-0.3.0/src/dbt_features/static/lineage.js +179 -0
  53. dbt_features-0.3.0/src/dbt_features/static/mermaid.min.js +2029 -0
  54. dbt_features-0.3.0/src/dbt_features/static/search.js +295 -0
  55. dbt_features-0.3.0/src/dbt_features/static/sort.js +142 -0
  56. dbt_features-0.3.0/src/dbt_features/static/style.css +922 -0
  57. dbt_features-0.3.0/src/dbt_features/static/tabs.js +36 -0
  58. dbt_features-0.3.0/src/dbt_features/static/theme.js +37 -0
  59. dbt_features-0.3.0/src/dbt_features/templates/base.html +104 -0
  60. dbt_features-0.3.0/src/dbt_features/templates/feature.html +143 -0
  61. dbt_features-0.3.0/src/dbt_features/templates/feature_group.html +213 -0
  62. dbt_features-0.3.0/src/dbt_features/templates/index.html +200 -0
  63. dbt_features-0.3.0/src/dbt_features/templates/lineage.html +49 -0
  64. dbt_features-0.3.0/src/dbt_features/templates/model.html +92 -0
  65. dbt_features-0.3.0/src/dbt_features/templates/models_index.html +35 -0
  66. dbt_features-0.3.0/tests/conftest.py +39 -0
  67. dbt_features-0.3.0/tests/fixtures/catalog.json +19 -0
  68. dbt_features-0.3.0/tests/fixtures/manifest.json +193 -0
  69. dbt_features-0.3.0/tests/fixtures/real/catalog.json +1 -0
  70. dbt_features-0.3.0/tests/fixtures/real/manifest.json +835 -0
  71. dbt_features-0.3.0/tests/test_cli.py +273 -0
  72. dbt_features-0.3.0/tests/test_dbapi_adapters.py +561 -0
  73. dbt_features-0.3.0/tests/test_enrichment.py +871 -0
  74. dbt_features-0.3.0/tests/test_inference.py +86 -0
  75. dbt_features-0.3.0/tests/test_parser.py +310 -0
  76. dbt_features-0.3.0/tests/test_real_manifest.py +151 -0
  77. dbt_features-0.3.0/tests/test_renderer.py +547 -0
  78. dbt_features-0.3.0/tests/test_schema.py +169 -0
  79. dbt_features-0.3.0/tests/test_snowflake_bigquery_adapters.py +460 -0
@@ -0,0 +1,25 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ *.egg
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ .env
11
+
12
+ .pytest_cache/
13
+ .coverage
14
+ .coverage.*
15
+ htmlcov/
16
+ .mypy_cache/
17
+ .ruff_cache/
18
+
19
+ target/
20
+ dbt_packages/
21
+ logs/
22
+ *.duckdb
23
+ *.duckdb.wal
24
+
25
+ .DS_Store
@@ -0,0 +1,136 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. The
4
+ format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
+ this project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.3.0] - UI redesign, ML model pages, faster search
10
+
11
+ ### Added
12
+ - **ML model pages.** Each consumer in `used_by` now gets its own page
13
+ listing every feature group and feature it consumes — closes the
14
+ feature-to-model loop in both directions.
15
+ - **Cmd-K / `/` search modal** with match highlighting, no-results
16
+ feedback, and a `kind:` filter (`kind:feature`, `kind:group`,
17
+ `kind:model`) for narrowing by entity type.
18
+ - **Faceted filter chips** on the homepage and feature-group pages
19
+ (entity, type, owner, lifecycle, freshness), URL-synced so filtered
20
+ views are linkable.
21
+ - **Sortable columns** on the feature table.
22
+ - **Related features** sections on feature-group and feature-detail
23
+ pages (related-by-consumer and related-by-type).
24
+ - **Summary stats bar** and per-entity type-distribution mini-bars on
25
+ the index.
26
+ - **Copy-to-clipboard buttons** on SQL, dbt-ref, and feature-name
27
+ snippets.
28
+ - **Owner and model indexes** on the catalog object.
29
+ - **Deep-link anchors** on feature rows.
30
+ - **A11y**: ARIA attributes on interactive controls, print stylesheet.
31
+
32
+ ### Changed
33
+ - **Homepage** rewritten around entity sections with faceted filtering
34
+ and URL-synced state.
35
+ - **Feature-group page** rewritten with an info grid, SQL / dbt-ref
36
+ snippet tabs, and a dedicated lineage section.
37
+ - **Feature-detail page** rewritten with an info grid and
38
+ related-features sections.
39
+ - **Lineage page** redesigned: Mermaid entity clusters, search-to-focus,
40
+ theme-aware re-render on toggle.
41
+ - **Global header** redesigned with a search trigger and a two-state
42
+ theme toggle; Safari-safe icons throughout.
43
+ - **Brand logo** is now the favicon.
44
+ - **CSS rewrite** with design tokens, type pills, entity dots, type
45
+ bars, and cleaner section spacing.
46
+
47
+ ### Fixed
48
+ - Broken feature-page URLs in some lineage edges.
49
+ - Stray HTML in the rendered feature table.
50
+ - Overly aggressive `ARRAY` -> `embedding` inference for non-vector
51
+ array columns.
52
+ - Stale docstrings and a misleading test name.
53
+
54
+ ## [0.2.0] - Auto-include feature columns
55
+
56
+ ### Changed (breaking)
57
+ - **Column inclusion is now automatic.** Marking a model with
58
+ `is_feature_table: true` is the only opt-in needed; every column on the
59
+ model becomes a feature *unless* it appears in `entity`, `grain`,
60
+ `timestamp_column`, or the new `exclude_columns` list, or its column
61
+ block sets `is_feature: false`. The old per-column `is_feature: true`
62
+ flag is gone — column blocks are now pure overrides.
63
+
64
+ ### Migration
65
+ 1. Remove `is_feature: true` from your column meta blocks — it's now a
66
+ no-op (still accepted, but redundant).
67
+ 2. Optionally add `exclude_columns: [...]` at the table level for
68
+ internal columns (`_loaded_at`, `_batch_id`, debug scratch, etc.).
69
+ 3. To exclude a single column without listing it at table level, set
70
+ `is_feature: false` on the column.
71
+ 4. Existing column overrides (`feature_type`, `used_by`, `null_behavior`,
72
+ `lifecycle`, `replacement`, `definition_version`) keep working
73
+ unchanged.
74
+
75
+ ### Added
76
+ - `exclude_columns` field on `FeatureTableMeta` for table-level column
77
+ exclusion.
78
+ - `feature_type` is now **inferred** from the warehouse `data_type` when
79
+ not declared. Conservative mapping: `INT*`/`FLOAT*`/`DECIMAL` ->
80
+ `numeric`, `BOOL` -> `boolean`, `DATE`/`TIMESTAMP` -> `timestamp`,
81
+ `ARRAY`/`VECTOR` -> `embedding`. `VARCHAR`/`TEXT` left unspecified
82
+ (override if needed).
83
+ - Schema bumped to `0.2`.
84
+
85
+ ## [0.1.x] - Warehouse enrichment
86
+
87
+ ### Added
88
+ - **Warehouse enrichment** (`--connection PROFILE` on `build`):
89
+ - DuckDB, Postgres, Redshift (password + IAM), Snowflake (password,
90
+ key-pair, SSO/OAuth), BigQuery (ADC, service-account, inline JSON).
91
+ - Reads `~/.dbt/profiles.yml` (honors `$DBT_PROFILES_DIR`).
92
+ - Renders green/yellow/red freshness status, last-update age, row count,
93
+ null %, and per-feature distinct-value count in the UI.
94
+ - JSON cache at `<output>/.cache/enrichment.json` with configurable TTL.
95
+ Survives `--clean` rebuilds; reused by subsequent `build` calls without
96
+ `--connection`.
97
+ - Per-feature-group failures captured on the snapshot rather than
98
+ aborting the build.
99
+ - **Lifecycle + `definition_version`** schema fields with rendered
100
+ badges and an inline deprecation banner pointing at the replacement.
101
+ - **Mermaid bundled locally** — lineage view works offline / behind CSP /
102
+ in air-gapped environments.
103
+ - **Themed Mermaid** to match the site palette and re-render on the dark/light
104
+ toggle.
105
+ - **`demo` command** — one-shot zero-setup catalog rendered into a temp
106
+ directory, with synthesized enrichment so screenshots show every state.
107
+ - **Dark mode** — defaults to dark; toggle persists in localStorage.
108
+ - **Favicon**.
109
+
110
+
111
+ ## [0.1.0] - Initial release
112
+
113
+ ### Added
114
+ - `feature_catalog` metadata schema (versioned, validated by Pydantic).
115
+ - Parser that reads `manifest.json` and (optionally) `catalog.json` without
116
+ importing `dbt-core`.
117
+ - Static HTML site generator with three views: feature-group index,
118
+ feature-group detail, individual feature detail. Plus a feature-table-only
119
+ lineage page rendered with Mermaid.
120
+ - Client-side substring search.
121
+ - CLI: `build`, `serve`, `validate`, `demo`. The `demo` command builds a
122
+ bundled sample catalog into a temp directory and serves it locally —
123
+ zero setup, nothing written to the user's project.
124
+ - Companion dbt package (`feature_catalog`) shipping a
125
+ `feature_catalog__validate` run-operation for compile-time metadata
126
+ validation.
127
+
128
+ ### Warehouse adapters shipped in v0.1
129
+ DuckDB, Postgres, Redshift (password + IAM auth), Snowflake (password,
130
+ key-pair, external-browser SSO, OAuth pass-through), BigQuery (ADC,
131
+ service-account keyfile, inline service-account JSON).
132
+
133
+ ### Not yet implemented
134
+ - Auto-derivation of `used_by` from dbt lineage / model registries.
135
+ - Multi-project federation.
136
+ - Live (non-cached) freshness — currently cached with a configurable TTL.
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept (and charge a
167
+ fee for) acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 dbt-feature-catalog contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.