Skip to content

Commit 22b9acb

Browse files
committed
Remove all dbt dependencies from metricflow test environments
We no longer use dbt at all inside of Metricflow prpoer, so this removes all dependencies. The main changes of interest involve the updates to the pre-commit configuration. The original config was not package-specific since all critical dependencies were available from the metricflow environment, so we could run linters without any custom installations. Now that metricflow has no dbt dependency in its dev environment, mypy will no longer typecheck correctly via pre-commit in the dbt-metricflow package. Since mypy is the only affected item we work around this by invoking it from the makefile for dbt-metricflow, and otherwise excluding dbt-metricflow from the pre-commit execution.
1 parent 648f98f commit 22b9acb

25 files changed

+26
-487
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Dependencies
2+
body: Remove dbt dependencies from Metricflow development packages. This will require an environment refresh across metricflow and dbt-metricflow.
3+
time: 2026-02-02T15:00:38.874789-05:00
4+
custom:
5+
Author: tlento
6+
Issue: "1967"

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ repos:
3333
rev: v1.3.0
3434
hooks:
3535
- id: mypy
36+
# dbt-metricflow requires dbt-core, which is not installed in the main metricflow dev environment.
37+
# We typecheck dbt-metricflow separately via direct invocation inside the `make lint` command
38+
exclude: "^dbt-metricflow/"
3639
args: [--show-error-codes]
3740
verbose: true
3841
# "system" means that the current environment will be used to run the hook, not the environment installed by

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ When running any one of the hatch commands, the environment is automatically set
5656
- Run the following commands in your shell, replacing the tags with the appropriate values:
5757
- `export MF_SQL_ENGINE_URL=<YOUR_WAREHOUSE_CONNECTION_URL>`
5858
- `export MF_SQL_ENGINE_PASSWORD=<YOUR_WAREHOUSE_PASSWORD>`
59-
- Run `make test-<engine>` to execute the entire test suite against the target engine. This will also set the `MF_TEST_ADAPTER_TYPE` to the proper engine identifier and pull in and configure the necessary dbt adapter dependencies for query execution. For example, to run tests against BigQuery, run `make test-bigquery`
59+
- Run `make test-<engine>` to execute the entire test suite against the target engine. This will pull in and configure the necessary dependencies for query execution. For example, to run tests against BigQuery, run `make test-bigquery`
6060
- By default, without `MF_SQL_ENGINE_URL` and `MF_SQL_ENGINE_PASSWORD` set, your tests will run against DuckDB.
6161
4. Run the linters with `make lint` at any time, but especially before submitting a PR. We use:
6262
- `Black` for formatting

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ test-trino:
9090
.PHONY: lint
9191
lint:
9292
hatch -v run dev-env:pre-commit run --verbose --all-files $(ADDITIONAL_PRECOMMIT_OPTIONS)
93+
@echo "\n\nTypechecking dbt-metricflow separately due to dbt-core dependency...\n\n"
94+
cd dbt-metricflow && hatch -v run dev-env:mypy --config-file ../mypy.ini dbt_metricflow
9395

9496
# Running data warehouses locally
9597
.PHONY: postgresql postgres

pyproject.toml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,14 @@ features = ["dev-env-requirements"]
106106

107107

108108
[tool.hatch.envs.dev-env.env-vars]
109-
MF_TEST_ADAPTER_TYPE="duckdb"
110109
MF_SQL_ENGINE_URL="duckdb://"
111-
# This allows us to use the classes in the `dbt-metricflow` package for tests without installing the package.
112-
# `dbt-metricflow` can't be installed as it has `metricflow` as a dependency.
113-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
110+
PYTHONPATH="metricflow-semantics"
114111

115112

116113
[tool.hatch.envs.postgres-env.env-vars]
117-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
114+
PYTHONPATH="metricflow-semantics"
118115
MF_SQL_ENGINE_URL="postgresql://metricflow@localhost:5432/metricflow"
119116
MF_SQL_ENGINE_PASSWORD="metricflowing"
120-
MF_TEST_ADAPTER_TYPE="postgres"
121117

122118
[tool.hatch.envs.postgres-env]
123119
description = "Dev environment for working with PostgreSQL"
@@ -129,17 +125,15 @@ features = ["postgres-env-requirements"]
129125
## configured independently of the hatch env construction
130126

131127
[tool.hatch.envs.bigquery-env.env-vars]
132-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
133-
MF_TEST_ADAPTER_TYPE="bigquery"
128+
PYTHONPATH="metricflow-semantics"
134129

135130
[tool.hatch.envs.bigquery-env]
136131
description = "Dev environment for working with BigQuery"
137132
template = "dev-env"
138133
features = ["bigquery-env-requirements"]
139134

140135
[tool.hatch.envs.databricks-env.env-vars]
141-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
142-
MF_TEST_ADAPTER_TYPE="databricks"
136+
PYTHONPATH="metricflow-semantics"
143137

144138

145139
[tool.hatch.envs.databricks-env]
@@ -149,19 +143,16 @@ features = ["databricks-env-requirements"]
149143

150144

151145
[tool.hatch.envs.redshift-env.env-vars]
152-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
153-
MF_TEST_ADAPTER_TYPE="redshift"
146+
PYTHONPATH="metricflow-semantics"
154147

155148
[tool.hatch.envs.redshift-env]
156149
description = "Dev environment for working with Redshift"
157150
template = "dev-env"
158151
features = ["redshift-env-requirements"]
159-
extra-dependencies = ["dbt-redshift>=1.8.0, <1.9.0"]
160152

161153

162154
[tool.hatch.envs.snowflake-env.env-vars]
163-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
164-
MF_TEST_ADAPTER_TYPE="snowflake"
155+
PYTHONPATH="metricflow-semantics"
165156

166157
[tool.hatch.envs.snowflake-env]
167158
description = "Dev environment for working with Snowflake"
@@ -170,8 +161,7 @@ features = ["snowflake-env-requirements"]
170161

171162

172163
[tool.hatch.envs.trino-env.env-vars]
173-
PYTHONPATH="metricflow-semantics:dbt-metricflow"
174-
MF_TEST_ADAPTER_TYPE = "trino"
164+
PYTHONPATH="metricflow-semantics"
175165
MF_SQL_ENGINE_URL = "trino://trino@localhost:8080/memory"
176166
MF_SQL_ENGINE_PASSWORD=""
177167

requirements-files/dev-env-requirements.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# SqlAlchemy for new client implementation
1+
# Test SqlClients depend on SqlAlchemy 2.x
22
sqlalchemy>=2.0.0, <2.1.0
3+
# DuckDB engine for DuckDB-backed, SqlAlchemy-based client
34
duckdb-engine>=0.13.0, <0.14.0
4-
5-
# dbt dependencies (kept for parallel operation during transition)
6-
dbt-core>=1.10.4, <1.11.0
7-
# Excluding 1.2.1 due to window functions returning incorrect results:
5+
# Excluding duckdb 1.2.1 due to window functions returning incorrect results:
86
# https://github.com/duckdb/duckdb/issues/16617
97
# Version 1.4.0 seems to have issues as well, so pinning to <1.4.0 until those are resolved.
108
duckdb !=1.2.1, <1.4.0
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
# SqlAlchemy Databricks connector
2-
databricks-sql-connector>=3.0.0, <4.0.0
1+
# SqlAlchemy Databricks connector, includes databricks-sql-connector
32
databricks-sqlalchemy>=2.0.0, <3.0.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# SqlAlchemy PostgreSQL connector
1+
# SqlALchemy includes a dialect for PostgreSQL compatible with psycopg2
22
psycopg2-binary>=2.9.0, <3.0.0

tests_metricflow/fixtures/dbt_projects/metricflow_testing/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests_metricflow/fixtures/dbt_projects/metricflow_testing/.user.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)