From a5045e7fb1a2f926976bb9ad0a535e67aa96d91e Mon Sep 17 00:00:00 2001 From: eakmanrq <6326532+eakmanrq@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:39:45 -0700 Subject: [PATCH] chore: improve adapter compatibility old dbt releases --- Makefile | 8 ++++++-- tests/dbt/test_config.py | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5335da5dc6..668769e2ef 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,12 @@ install-dev-dbt-%: fi; \ $(MAKE) install-dev; \ if [ "$$version" = "1.6.0" ]; then \ - echo "Applying pydantic override for dbt 1.6.0"; \ - $(PIP) install 'pydantic>=2.0.0' --reinstall; \ + echo "Applying overrides for dbt 1.6.0"; \ + $(PIP) install 'pydantic>=2.0.0' 'google-cloud-bigquery==3.30.0' 'databricks-sdk==0.28.0' --reinstall; \ + fi; \ + if [ "$$version" = "1.7.0" ]; then \ + echo "Applying overrides for dbt 1.7.0"; \ + $(PIP) install 'databricks-sdk==0.28.0' --reinstall; \ fi; \ mv pyproject.toml.backup pyproject.toml; \ echo "Restored original pyproject.toml" diff --git a/tests/dbt/test_config.py b/tests/dbt/test_config.py index a79ee59b69..1945cdfeb1 100644 --- a/tests/dbt/test_config.py +++ b/tests/dbt/test_config.py @@ -13,6 +13,7 @@ from sqlmesh.core.dialect import jinja_query from sqlmesh.core.model import SqlModel from sqlmesh.core.model.kind import OnDestructiveChange, OnAdditiveChange +from sqlmesh.dbt.builtin import Api from sqlmesh.dbt.column import ColumnConfig from sqlmesh.dbt.common import Dependencies from sqlmesh.dbt.context import DbtContext @@ -1092,6 +1093,23 @@ def test_sqlmesh_model_kwargs_columns_override(): assert kwargs.get("columns") == {"c": exp.DataType.build(exp.DataType.Type.UINT)} +@pytest.mark.parametrize( + "dialect", + [ + "databricks", + "duckdb", + "postgres", + "redshift", + "snowflake", + "bigquery", + "trino", + "clickhouse", + ], +) +def test_api_class_loading(dialect: str): + Api(dialect) + + def test_empty_vars_config(tmp_path): """Test that a dbt project can be loaded with an empty vars config.""" dbt_project_dir = tmp_path / "test_project"