Skip to content

feat: add MetricFlow compatibility patch for dbt-altertable#26

Open
fvaleye wants to merge 1 commit intomainfrom
fl/metricflow-integration
Open

feat: add MetricFlow compatibility patch for dbt-altertable#26
fvaleye wants to merge 1 commit intomainfrom
fl/metricflow-integration

Conversation

@fvaleye
Copy link
Copy Markdown
Contributor

@fvaleye fvaleye commented May 5, 2026

Summary

Using MetricFlow with dbt-altertable, dbt-metricflow only recognizes a hardcoded list of adapters.
This adds a minimal patch to AdapterBackedSqlClient.__init__ so it accepts the altertable adapter and routes it through DuckDB's SQL renderer, matching DuckLake's SQL dialect.
The patch is auto-applied when dbt-metricflow is installed.

@fvaleye fvaleye requested review from leo-altertable, redox and utay May 5, 2026 17:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional MetricFlow compatibility shim so dbt-metricflow can work with the altertable adapter by routing SQL rendering through MetricFlow’s DuckDB renderer (matching DuckLake’s dialect), and wires it to auto-apply when MetricFlow is installed.

Changes:

  • Add a metricflow optional dependency extra (dbt-metricflow>=0.12.0).
  • Introduce an import-time monkeypatch of AdapterBackedSqlClient.__init__ to treat altertable as DUCKDB.
  • Update uv.lock to include the new optional dependency and its transitive packages.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
uv.lock Adds the metricflow extra and locks dbt-metricflow + transitive dependencies.
pyproject.toml Defines the new optional dependency group metricflow.
dbt/adapters/altertable/metricflow.py Implements the MetricFlow monkeypatch to route altertable through DuckDB SQL rendering.
dbt/adapters/altertable/__init__.py Auto-imports the patch when MetricFlow is importable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dbt/adapters/altertable/__init__.py Outdated
Comment thread dbt/adapters/altertable/metricflow.py
Comment thread dbt/adapters/altertable/metricflow.py
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dbt/adapters/altertable/__init__.py
Comment thread pyproject.toml
Comment thread dbt/adapters/altertable/metricflow.py
@fvaleye fvaleye force-pushed the fl/metricflow-integration branch from cad1f61 to 9e16ea2 Compare May 5, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants