dbt-metricflow-sql 0.3.2__tar.gz → 0.4.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 (19) hide show
  1. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/PKG-INFO +1 -3
  2. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/README.md +30 -30
  3. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/pyproject.toml +1 -4
  4. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/fragment.schema.json +1 -1
  5. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/llms-full.txt +440 -298
  6. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/plugin.py +33 -8
  7. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/semantics.py +89 -47
  8. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/server.py +47 -0
  9. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/uv.lock +1 -5
  10. dbt_metricflow_sql-0.3.2/src/dbt_metricflow_sql/legacy.py +0 -1286
  11. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/.gitignore +0 -0
  12. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/LICENSE +0 -0
  13. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/PYPI.md +0 -0
  14. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/__init__.py +0 -0
  15. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/cli.py +0 -0
  16. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/client.py +0 -0
  17. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/dependencies.py +0 -0
  18. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/docs.py +0 -0
  19. {dbt_metricflow_sql-0.3.2 → dbt_metricflow_sql-0.4.0}/src/dbt_metricflow_sql/sl_config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dbt-metricflow-sql
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Summary: dbt v1 plugin for MetricFlow
5
5
  Project-URL: Documentation, https://docs-internal-git-mfsql-dbt-labs.vercel.app/metricflow
6
6
  License-Expression: LicenseRef-Fivetran
@@ -9,8 +9,6 @@ Classifier: Programming Language :: Python :: 3
9
9
  Requires-Python: >=3.9
10
10
  Requires-Dist: dbt-core>=1.9
11
11
  Requires-Dist: jsonschema>=4.19
12
- Provides-Extra: compat
13
- Requires-Dist: sqlglot>=30.27; extra == 'compat'
14
12
  Provides-Extra: sidecar
15
13
  Requires-Dist: metricflow-sql-sidecar; extra == 'sidecar'
16
14
  Description-Content-Type: text/markdown
@@ -32,8 +32,8 @@ its stdin closes.
32
32
 
33
33
  ## Semantics
34
34
 
35
- Declare semantics in schema files: `datasets`, `entities`, `constellations` and `pages` at the
36
- root, and dataset fields on models, seeds, snapshots and source tables. They're the objects of a
35
+ Declare semantics in schema files: `datasets`, `entities`, `constellations` and `pages` under the
36
+ `semantics` key, and dataset fields on models, seeds, snapshots and source tables. They're the objects of a
37
37
  [v1 fragment](../metricflow-sql/src/metricflow_sql/schemas/v1/fragment.py), whose named
38
38
  collections are dbt-style lists of objects with a `name`:
39
39
 
@@ -50,23 +50,24 @@ models:
50
50
  - name: customers
51
51
  dataset: true # a dataset of nothing but its columns
52
52
 
53
- datasets:
54
- - name: refunds
55
- source: ref('refunds') # or source('<source>', '<table>')
56
-
57
- constellations:
58
- - name: sales
59
- roles:
60
- - name: customer
61
- datatype: REF(customer)
62
- metrics:
63
- - name: revenue
64
- expr: AGG(orders.revenue)
65
- assignments:
66
- - dataset: orders
67
- roles:
68
- - name: customer
69
- expr: customer
53
+ semantics:
54
+ datasets:
55
+ - name: refunds
56
+ source: ref('refunds') # or source('<source>', '<table>')
57
+
58
+ constellations:
59
+ - name: sales
60
+ roles:
61
+ - name: customer
62
+ datatype: REF(customer)
63
+ metrics:
64
+ - name: revenue
65
+ expr: AGG(orders.revenue)
66
+ assignments:
67
+ - dataset: orders
68
+ roles:
69
+ - name: customer
70
+ expr: customer
70
71
  ```
71
72
 
72
73
  A node is a dataset, named after it, if it sets `calculations`, `relationships`, `parameters` or
@@ -193,25 +194,24 @@ warns of keys it doesn't know as custom ones; the plugin declares these to it.
193
194
 
194
195
  ## Legacy MetricFlow
195
196
 
196
- To try MetricFlow on a project's legacy semantic models and metrics, without rewriting them, install
197
- the plugin with its `compat` extra, and turn on legacy compatibility:
198
-
199
- ```sh
200
- pip install 'dbt-metricflow-sql[compat]'
201
- ```
197
+ To try MetricFlow on a project's legacy semantic models and metrics, without rewriting them, set
198
+ `metricflow_convert_legacy`:
202
199
 
203
200
  ```yaml
204
201
  # dbt_project.yml
205
202
  vars:
206
- metricflow_legacy_compatibility: true
203
+ metricflow_convert_legacy: true
207
204
  ```
208
205
 
209
206
  Parse then converts the project's legacy semantics, as dbt writes them to
210
207
  `semantic_manifest.json`, into one more fragment of the bundle, `legacy_semantic_manifest.json`,
211
- next to the fragments of its MetricFlow semantics. Its objects are in the `legacy` namespace, so
212
- they don't collide with the project's own, e.g. a semantic model `orders` is the dataset
213
- `legacy.orders`, beside a MetricFlow dataset `orders`. Every metric is a metric of one
214
- constellation, `legacy.metrics`:
208
+ next to the fragments of its MetricFlow semantics. The MetricFlow server converts them, run as
209
+ `metricflow-serve convert-legacy` (see `metricflow_sql.converters.legacy`), so with it set, parse
210
+ needs the `sidecar` extra, or the `metricflow_server` var, as compiling MetricFlow models does.
211
+
212
+ The fragment's objects are in the `legacy` namespace, so they don't collide with the project's
213
+ own, e.g. a semantic model `orders` is the dataset `legacy.orders`, beside a MetricFlow dataset
214
+ `orders`. Every metric is a metric of one constellation, `legacy.metrics`:
215
215
 
216
216
  ```sql
217
217
  SELECT DATE_TRUNC('month', metric_time), customer.region, AGG(revenue)
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "dbt-metricflow-sql"
3
3
  # A placeholder: a release sets its tag's version, with scripts/set_version.py.
4
- version = "0.3.2"
4
+ version = "0.4.0"
5
5
  description = "dbt v1 plugin for MetricFlow"
6
6
  # Its PyPI page: README.md is for this repository.
7
7
  readme = "PYPI.md"
@@ -25,9 +25,6 @@ dbtsl = "dbt_metricflow_sql.cli:main"
25
25
  # The MetricFlow server it runs by default, which needs no Python of its own: only projects with
26
26
  # MetricFlow models run one.
27
27
  sidecar = ["metricflow-sql-sidecar"]
28
- # Legacy compatibility, `metricflow_legacy_compatibility`, which writes the warehouse's SQL for
29
- # legacy MetricFlow's aggregations, e.g. a percentile.
30
- compat = ["sqlglot>=30.27"]
31
28
 
32
29
  [project.urls]
33
30
  Documentation = "https://docs-internal-git-mfsql-dbt-labs.vercel.app/metricflow"
@@ -1070,7 +1070,7 @@
1070
1070
  "description": "How a relationship binds one of its target's fields.",
1071
1071
  "properties": {
1072
1072
  "expr": {
1073
- "description": "A SQL expression, relative to the dataset.",
1073
+ "description": "A SQL expression, relative to the dataset. `:name` passes on a key the dataset itself was joined by, e.g. `:as_of`.",
1074
1074
  "type": "string"
1075
1075
  },
1076
1076
  "meta": {