From 4c1d13c1dc081e51d61dc44babf1a18675ba0820 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 3 Jun 2024 16:19:36 -0700 Subject: [PATCH 1/8] /* PR_START p--py312 10 */ Support Python 3.12 in `dbt-metricflow`. --- dbt-metricflow/pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbt-metricflow/pyproject.toml b/dbt-metricflow/pyproject.toml index 497aad6542..9d90316cfd 100644 --- a/dbt-metricflow/pyproject.toml +++ b/dbt-metricflow/pyproject.toml @@ -7,7 +7,7 @@ name = "dbt-metricflow" version = "0.6.0" description = "Execute commands against the MetricFlow semantic layer with dbt." readme = "README.md" -requires-python = ">=3.8,<3.12" +requires-python = ">=3.8,<3.13" license = "BUSL-1.1" authors = [ { name = "dbt Labs", email = "info@dbtlabs.com" }, @@ -20,6 +20,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] @@ -32,7 +33,7 @@ dependencies = [ # Internal dependencies "dbt-core>=1.7.4, <1.8.0", - "metricflow>=0.205.0, <0.206.0", + "metricflow>=0.206.dev3, <0.207.0", # dsi version should be fixed by MetricFlow/dbt-core, not set here "dbt-semantic-interfaces", From 3a6f9a72c329e00a2c9d0595c366215ae05cbcda Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 30 May 2024 19:17:29 -0700 Subject: [PATCH 2/8] Update workflows to support Python 3.12. --- .github/workflows/ci-metricflow-unit-tests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-metricflow-unit-tests.yaml b/.github/workflows/ci-metricflow-unit-tests.yaml index 9106eaf83a..d135da5927 100644 --- a/.github/workflows/ci-metricflow-unit-tests.yaml +++ b/.github/workflows/ci-metricflow-unit-tests.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.11"] + python-version: ["3.8", "3.12"] steps: - name: Check-out the repo uses: actions/checkout@v3 @@ -46,10 +46,10 @@ jobs: - name: Check-out the repo uses: actions/checkout@v3 - - name: Test w/ Python 3.11 + - name: Test w/ Python 3.12 uses: ./.github/actions/run-mf-tests with: - python-version: "3.11" + python-version: "3.12" make-target: "test-postgresql" metricflow-unit-tests: From 12ee600d5576e4dd7bf45c09314d1398968de7a0 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 27 May 2024 17:38:38 -0700 Subject: [PATCH 3/8] Update docstring to reflect updated signature. --- .../cli/dbt_connectors/adapter_backed_client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py b/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py index 4dcc8a8f84..9520e9e5af 100644 --- a/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py +++ b/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py @@ -132,9 +132,8 @@ def query( Args: stmt: The SQL query statement to run. This should produce output via a SELECT - sql_bind_parameters: The parameter replacement mapping for filling in - concrete values for SQL query parameters. - extra_tags: An object containing JSON serialized tags meant for annotating queries. + sql_bind_parameters: The parameter replacement mapping for filling in concrete values for SQL query + parameters. """ start = time.time() request_id = SqlRequestId(f"mf_rid__{random_id()}") From 9f0cf648797758beddd8354e150ac0bc9c5850ea Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 27 May 2024 17:46:57 -0700 Subject: [PATCH 4/8] Update project configuration to share dependencies / remove editable install. --- .../requirements-cli.txt | 13 ++ .../requirements-dbt-bigquery.txt | 1 + .../requirements-dbt-databricks.txt | 1 + .../requirements-dbt-duckdb.txt | 1 + .../requirements-dbt-postgres.txt | 1 + .../requirements-dbt-redshift.txt | 1 + .../requirements-dbt-snowflake.txt | 1 + .../requirements-dbt-trino.txt | 1 + .../requirements-metricflow.txt | 1 + dbt-metricflow/pyproject.toml | 48 +++---- .../requirements-dev-packages.txt | 9 ++ .../requirements-sql-client-packages.txt | 4 + ...requirements-trino-sql-client-packages.txt | 1 + pyproject.toml | 131 ++++++++---------- 14 files changed, 113 insertions(+), 101 deletions(-) create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-cli.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt create mode 100644 dbt-metricflow/extra-hatch-configuration/requirements-metricflow.txt create mode 100644 extra-hatch-configuration/requirements-dev-packages.txt create mode 100644 extra-hatch-configuration/requirements-sql-client-packages.txt create mode 100644 extra-hatch-configuration/requirements-trino-sql-client-packages.txt diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt b/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt new file mode 100644 index 0000000000..9e7e9c3ea4 --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt @@ -0,0 +1,13 @@ +# Internal dependencies +dbt-core>=1.7.0, <1.8.0 + +# dsi version should be fixed by MetricFlow/dbt-core, not set here +dbt-semantic-interfaces + +# CLI-related +Jinja2>=3.1.3 +halo>=0.0.31, <0.1.0 +update-checker>=0.18.0, <0.19.0 + +# Bug with mypy: https://github.com/pallets/click/issues/2558#issuecomment-1656546003 +click>=8.1.6 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt new file mode 100644 index 0000000000..db99301096 --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt @@ -0,0 +1 @@ +dbt-bigquery>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt new file mode 100644 index 0000000000..00aea9690e --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt @@ -0,0 +1 @@ +dbt-databricks>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt new file mode 100644 index 0000000000..a2f03708d7 --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt @@ -0,0 +1 @@ +dbt-duckdb>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt new file mode 100644 index 0000000000..75095f1cba --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt @@ -0,0 +1 @@ +dbt-postgres>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt new file mode 100644 index 0000000000..14c39023eb --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt @@ -0,0 +1 @@ +dbt-redshift>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt new file mode 100644 index 0000000000..52f4c901fd --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt @@ -0,0 +1 @@ +dbt-snowflake>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt new file mode 100644 index 0000000000..677cc6a1b0 --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt @@ -0,0 +1 @@ +dbt-trino>=1.7.0, <1.8.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-metricflow.txt b/dbt-metricflow/extra-hatch-configuration/requirements-metricflow.txt new file mode 100644 index 0000000000..ac4dc48b30 --- /dev/null +++ b/dbt-metricflow/extra-hatch-configuration/requirements-metricflow.txt @@ -0,0 +1 @@ +metricflow>=0.206.0.dev3, <0.207.0 diff --git a/dbt-metricflow/pyproject.toml b/dbt-metricflow/pyproject.toml index 9d90316cfd..a3239c327e 100644 --- a/dbt-metricflow/pyproject.toml +++ b/dbt-metricflow/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling~=1.14.0"] +requires = ["hatchling~=1.14.0", "hatch-requirements-txt >= 0.4.1, <0.5.0"] build-backend = "hatchling.build" [project] @@ -24,19 +24,14 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] -dependencies = [ - # cli dependencies - "Jinja2>=3.1.3", - "click>=7.1.2", - "halo>=0.0.31, <0.1.0", - "update-checker>=0.18.0, <0.19.0", - # Internal dependencies - "dbt-core>=1.7.4, <1.8.0", - "metricflow>=0.206.dev3, <0.207.0", +# Dependencies are specified through the `hatch-requirements-txt` plug-in. +dynamic = ["dependencies", "optional-dependencies"] - # dsi version should be fixed by MetricFlow/dbt-core, not set here - "dbt-semantic-interfaces", +[tool.hatch.metadata.hooks.requirements_txt] +files = [ + "extra-hatch-configuration/requirements-cli.txt", + "extra-hatch-configuration/requirements-metricflow.txt", ] [project.urls] @@ -45,27 +40,24 @@ dependencies = [ [project.scripts] mf = 'dbt_metricflow.cli.main:cli' -[project.optional-dependencies] -bigquery = [ - "dbt-bigquery>=1.7.0, <1.8.0" +[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies] +dbt-duckdb = [ + "extra-hatch-configuration/requirements-dbt-duckdb.txt" ] -databricks = [ - "dbt-databricks>=1.7.0, <1.8.0" +dbt-postgres = [ + "extra-hatch-configuration/requirements-dbt-postgres.txt" ] -duckdb = [ - "dbt-duckdb>=1.7.0, <1.8.0" +dbt-redshift = [ + "extra-hatch-configuration/requirements-dbt-redshift.txt" ] -postgres = [ - "dbt-postgres>=1.7.0, <1.8.0" +dbt-snowflake = [ + "extra-hatch-configuration/requirements-dbt-snowflake.txt" ] -redshift = [ - "dbt-redshift>=1.7.0, <1.8.0" +dbt-bigquery = [ + "extra-hatch-configuration/requirements-dbt-bigquery.txt" ] -snowflake = [ - "dbt-snowflake>=1.7.0, <1.8.0" -] -trino = [ - "dbt-trino>=1.7.0, <1.8.0" +dbt-databricks = [ + "extra-hatch-configuration/requirements-dbt-databricks.txt" ] [tool.hatch.build.targets.sdist] diff --git a/extra-hatch-configuration/requirements-dev-packages.txt b/extra-hatch-configuration/requirements-dev-packages.txt new file mode 100644 index 0000000000..b0ddd88f8d --- /dev/null +++ b/extra-hatch-configuration/requirements-dev-packages.txt @@ -0,0 +1,9 @@ +# Developer tools +mypy>=1.7.0, <1.8.0 +pre-commit>=3.2.2, <3.3.0 +pytest-mock>=3.7.0, <3.8.0 +pytest-xdist>=3.2.1, <3.3.0 +pytest>=7.1.1, < 7.2.0 +types-PyYAML +types-python-dateutil +types-tabulate diff --git a/extra-hatch-configuration/requirements-sql-client-packages.txt b/extra-hatch-configuration/requirements-sql-client-packages.txt new file mode 100644 index 0000000000..8fa34decb8 --- /dev/null +++ b/extra-hatch-configuration/requirements-sql-client-packages.txt @@ -0,0 +1,4 @@ +# These are currently separate for ease of removal, but due to the way Python +# handles import statements they are required in all test environments +SQLAlchemy>=1.4.42, <1.5.0 +sqlalchemy2-stubs>=0.0.2a21, <0.0.3 diff --git a/extra-hatch-configuration/requirements-trino-sql-client-packages.txt b/extra-hatch-configuration/requirements-trino-sql-client-packages.txt new file mode 100644 index 0000000000..ce89b89bcc --- /dev/null +++ b/extra-hatch-configuration/requirements-trino-sql-client-packages.txt @@ -0,0 +1 @@ +trino>=0.328.0, <0.329.0 diff --git a/pyproject.toml b/pyproject.toml index 5baa9d9ae2..4a59472126 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling~=1.14.0"] +requires = ["hatchling~=1.14.0", "hatch-requirements-txt >= 0.4.1, <0.5.0"] build-backend = "hatchling.build" [project] @@ -39,50 +39,44 @@ dependencies = [ "typing_extensions>=4.4, <5.0", ] +# Optional dependencies are specified through the `hatch-requirements-txt` plug-in. +dynamic = ["optional-dependencies"] + [project.urls] Documentation = "https://docs.getdbt.com/docs/build/about-metricflow" "Source Code" = "https://github.com/dbt-labs/metricflow" -[project.optional-dependencies] +[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies] dev-packages = [ - # Developer tools - "mypy>=1.7.0, <1.8.0", - "pre-commit>=3.2.2, <3.3.0", - "pytest-mock>=3.7.0, <3.8.0", - "pytest-xdist>=3.2.1, <3.3.0", - "pytest>=7.1.1, < 7.2.0", - "types-PyYAML", - "types-python-dateutil", - "types-tabulate", - - # Test and CLI development dependencies. - # These should generally match what's in dbt-metricflow/pyproject.toml, but may - # diverge during upgrade phases or for other reasons - # - # Note we do not currently depend on dbt-core because updates across minor version - # boundaries cause problems with tests against future versions of dbt-semantic-interfaces. - # In future we will refine this packaging to depend on stable dbt-adapter interfaces in - # the development builds, but those packages do not yet support all of our needs so we - # hack around the problem with editable pre-installs in the various dev environments. - # Note this only works because we don't use the dbt packages for anything other than - # managing warehouse connections and dispatching queries, so this is not a pattern - # anyone else should be emulating even as a short-term hack. - - "halo>=0.0.31, <0.1.0", - "update-checker>=0.18.0, <0.19.0", - - # Bug with mypy: https://github.com/pallets/click/issues/2558#issuecomment-1656546003 - "click>=8.1.6", -] - -# These are currently separate for ease of removal, but due to the way Python -# handles import statements they are required in all test environments + "extra-hatch-configuration/requirements-dev-packages.txt", + "dbt-metricflow/extra-hatch-configuration/requirements-cli.txt" +] sql-client-packages = [ - "SQLAlchemy>=1.4.42, <1.5.0", - "sqlalchemy2-stubs>=0.0.2a21, <0.0.3", + "extra-hatch-configuration/requirements-sql-client-packages.txt" ] trino-sql-client-packages = [ - "trino>=0.327.0, <0.328.0", + "extra-hatch-configuration/requirements-trino-sql-client-packages.txt" +] +dbt-duckdb = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt" +] +dbt-postgres = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt" +] +dbt-redshift = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt" +] +dbt-snowflake = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt" +] +dbt-bigquery = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt" +] +dbt-databricks = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt" +] +dbt-trino = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt" ] # There are files that hatch will always include as well (e.g. the LICENSE file). @@ -110,22 +104,25 @@ packages = ["metricflow", "metricflow-semantics/metricflow_semantics"] [tool.hatch.envs.dev-env] description = "Environment for development. Includes a DuckDB-backed client." - -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[duckdb]", -] +run = "run-coverage --no-cov" +dependencies = ["metricflow-semantics @ {root:uri}/metricflow-semantics"] features = [ "dev-packages", "sql-client-packages", + "dbt-duckdb", ] [tool.hatch.envs.dev-env.env-vars] MF_TEST_ADAPTER_TYPE="duckdb" MF_SQL_ENGINE_URL="duckdb://" +# This allows us to use the classes in the `dbt-metricflow` package for tests without installing the package. +# `dbt-metricflow` can't be installed as it has `metricflow` as a dependency. +PYTHONPATH="./dbt-metricflow" + [tool.hatch.envs.postgres-env.env-vars] +PYTHONPATH="./dbt-metricflow" MF_SQL_ENGINE_URL="postgresql://metricflow@localhost:5432/metricflow" MF_SQL_ENGINE_PASSWORD="metricflowing" MF_TEST_ADAPTER_TYPE="postgres" @@ -133,84 +130,75 @@ MF_TEST_ADAPTER_TYPE="postgres" [tool.hatch.envs.postgres-env] description = "Dev environment for working with Postgres adapter" -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[postgres]" -] - features = [ "dev-packages", "sql-client-packages", + "dbt-postgres", ] + # NOTE: All of the below should have their authentication credentials # configured independently of the hatch env construction [tool.hatch.envs.bigquery-env.env-vars] +PYTHONPATH="./dbt-metricflow" MF_TEST_ADAPTER_TYPE="bigquery" [tool.hatch.envs.bigquery-env] description = "Dev environment for working with the BigQuery adapter" -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[bigquery]" -] - features = [ "dev-packages", "sql-client-packages", + "dbt-bigquery", ] + [tool.hatch.envs.databricks-env.env-vars] +PYTHONPATH="./dbt-metricflow" MF_TEST_ADAPTER_TYPE="databricks" + [tool.hatch.envs.databricks-env] description = "Dev environment for working with the Databricks adapter" -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[databricks]" -] - features = [ "dev-packages", "sql-client-packages", + "dbt-databricks", ] + [tool.hatch.envs.redshift-env.env-vars] +PYTHONPATH="./dbt-metricflow" MF_TEST_ADAPTER_TYPE="redshift" [tool.hatch.envs.redshift-env] description = "Dev environment for working with the Redshift adapter" -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[redshift]" -] - features = [ "dev-packages", "sql-client-packages", + "dbt-redshift" ] + [tool.hatch.envs.snowflake-env.env-vars] +PYTHONPATH="./dbt-metricflow" MF_TEST_ADAPTER_TYPE="snowflake" [tool.hatch.envs.snowflake-env] description = "Dev environment for working with Snowflake adapter" -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[snowflake]" -] - features = [ "dev-packages", "sql-client-packages", + "dbt-snowflake", ] + [tool.hatch.envs.trino-env.env-vars] +PYTHONPATH="./dbt-metricflow" MF_TEST_ADAPTER_TYPE = "trino" MF_SQL_ENGINE_URL = "trino://trino@localhost:8080/" DBT_ENV_SECRET_CATALOG="memory" @@ -218,24 +206,21 @@ DBT_ENV_SECRET_CATALOG="memory" [tool.hatch.envs.trino-env] description = "Dev environment for working with the Trino adapter" -pre-install-commands = [ - "pip install -e ./metricflow-semantics", - "pip install -e ./dbt-metricflow[trino]" -] - features = [ "dev-packages", "sql-client-packages", "trino-sql-client-packages", + "dbt-trino" ] + [tool.black] line-length = 120 +[tool.pytest.ini_options] # Many deprecation warnings come from 3rd-party libraries and make the # output of pytest noisy. Since no action is going to be taken, hide those # warnings. -[tool.pytest.ini_options] filterwarnings = [ "ignore:Deprecated call to.*", "ignore:pkg_resources is deprecated as an API" From ef0e82c708b4bc8c08fcfcc16397ac62641542a7 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 3 Jun 2024 16:52:53 -0700 Subject: [PATCH 5/8] Update dependencies to dbt 1.8. --- dbt-metricflow/extra-hatch-configuration/requirements-cli.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-bigquery.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-databricks.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-duckdb.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-postgres.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-redshift.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-snowflake.txt | 2 +- .../extra-hatch-configuration/requirements-dbt-trino.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt b/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt index 9e7e9c3ea4..ae9d0ae471 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-cli.txt @@ -1,5 +1,5 @@ # Internal dependencies -dbt-core>=1.7.0, <1.8.0 +dbt-core>=1.8.0, <1.9.0 # dsi version should be fixed by MetricFlow/dbt-core, not set here dbt-semantic-interfaces diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt index db99301096..3ef6a2994c 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt @@ -1 +1 @@ -dbt-bigquery>=1.7.0, <1.8.0 +dbt-bigquery>=1.8.0, <1.9.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt index 00aea9690e..ab8e6417ea 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt @@ -1 +1 @@ -dbt-databricks>=1.7.0, <1.8.0 +dbt-databricks>=1.8.0, <1.9.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt index a2f03708d7..a91d11d94d 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt @@ -1 +1 @@ -dbt-duckdb>=1.7.0, <1.8.0 +dbt-duckdb>=1.8.0, <1.9.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt index 75095f1cba..832aa9e91f 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-postgres.txt @@ -1 +1 @@ -dbt-postgres>=1.7.0, <1.8.0 +dbt-postgres>=1.8.0, <1.9.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt index 14c39023eb..7658ca24f1 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-redshift.txt @@ -1 +1 @@ -dbt-redshift>=1.7.0, <1.8.0 +dbt-redshift>=1.8.0, <1.9.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt index 52f4c901fd..937f1b52fc 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt @@ -1 +1 @@ -dbt-snowflake>=1.7.0, <1.8.0 +dbt-snowflake>=1.8.0, <1.9.0 diff --git a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt index 677cc6a1b0..bc3390eacb 100644 --- a/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt +++ b/dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt @@ -1 +1 @@ -dbt-trino>=1.7.0, <1.8.0 +dbt-trino>=1.8.0, <1.9.0 From 18fb2e78e70961ece330f50e7ee4eb1c6d6ffaae Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 3 Jun 2024 16:53:05 -0700 Subject: [PATCH 6/8] Update dbt imports. --- .../dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py b/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py index 9520e9e5af..98d76916b9 100644 --- a/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py +++ b/dbt-metricflow/dbt_metricflow/cli/dbt_connectors/adapter_backed_client.py @@ -5,7 +5,7 @@ import time from dbt.adapters.base.impl import BaseAdapter -from dbt.exceptions import DbtDatabaseError +from dbt_common.exceptions.base import DbtDatabaseError from dbt_semantic_interfaces.enum_extension import assert_values_exhausted from metricflow_semantics.errors.error_classes import SqlBindParametersNotSupportedError from metricflow_semantics.mf_logging.formatting import indent From ae082cfb93dca47e42e489a46929b7e07459364f Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Mon, 3 Jun 2024 17:45:56 -0700 Subject: [PATCH 7/8] Add change log for #1243. --- .changes/unreleased/Features-20240603-174544.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Features-20240603-174544.yaml diff --git a/.changes/unreleased/Features-20240603-174544.yaml b/.changes/unreleased/Features-20240603-174544.yaml new file mode 100644 index 0000000000..a70200fe89 --- /dev/null +++ b/.changes/unreleased/Features-20240603-174544.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Update `dbt-metricflow` dependencies to use `dbt*` 1.8 packages +time: 2024-06-03T17:45:44.215307-07:00 +custom: + Author: plypaul + Issue: "1243" From 2bd682cc3436ee09d549dbd358c0e049bfa99d9a Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 4 Jun 2024 18:04:53 -0700 Subject: [PATCH 8/8] Address comments. --- dbt-metricflow/pyproject.toml | 13 ++++++---- pyproject.toml | 49 +++++++++++++++-------------------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/dbt-metricflow/pyproject.toml b/dbt-metricflow/pyproject.toml index a3239c327e..f7fa9fa95e 100644 --- a/dbt-metricflow/pyproject.toml +++ b/dbt-metricflow/pyproject.toml @@ -41,6 +41,12 @@ files = [ mf = 'dbt_metricflow.cli.main:cli' [tool.hatch.metadata.hooks.requirements_txt.optional-dependencies] +dbt-bigquery = [ + "extra-hatch-configuration/requirements-dbt-bigquery.txt" +] +dbt-databricks = [ + "extra-hatch-configuration/requirements-dbt-databricks.txt" +] dbt-duckdb = [ "extra-hatch-configuration/requirements-dbt-duckdb.txt" ] @@ -53,11 +59,8 @@ dbt-redshift = [ dbt-snowflake = [ "extra-hatch-configuration/requirements-dbt-snowflake.txt" ] -dbt-bigquery = [ - "extra-hatch-configuration/requirements-dbt-bigquery.txt" -] -dbt-databricks = [ - "extra-hatch-configuration/requirements-dbt-databricks.txt" +dbt-trino = [ + "extra-hatch-configuration/requirements-dbt-trino.txt" ] [tool.hatch.build.targets.sdist] diff --git a/pyproject.toml b/pyproject.toml index 4a59472126..1c19397bed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,15 +47,11 @@ Documentation = "https://docs.getdbt.com/docs/build/about-metricflow" "Source Code" = "https://github.com/dbt-labs/metricflow" [tool.hatch.metadata.hooks.requirements_txt.optional-dependencies] -dev-packages = [ - "extra-hatch-configuration/requirements-dev-packages.txt", - "dbt-metricflow/extra-hatch-configuration/requirements-cli.txt" -] -sql-client-packages = [ - "extra-hatch-configuration/requirements-sql-client-packages.txt" +dbt-bigquery = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt" ] -trino-sql-client-packages = [ - "extra-hatch-configuration/requirements-trino-sql-client-packages.txt" +dbt-databricks = [ + "dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt" ] dbt-duckdb = [ "dbt-metricflow/extra-hatch-configuration/requirements-dbt-duckdb.txt" @@ -69,15 +65,19 @@ dbt-redshift = [ dbt-snowflake = [ "dbt-metricflow/extra-hatch-configuration/requirements-dbt-snowflake.txt" ] -dbt-bigquery = [ - "dbt-metricflow/extra-hatch-configuration/requirements-dbt-bigquery.txt" -] -dbt-databricks = [ - "dbt-metricflow/extra-hatch-configuration/requirements-dbt-databricks.txt" -] dbt-trino = [ "dbt-metricflow/extra-hatch-configuration/requirements-dbt-trino.txt" ] +dev-packages = [ + "extra-hatch-configuration/requirements-dev-packages.txt", + "dbt-metricflow/extra-hatch-configuration/requirements-cli.txt" +] +sql-client-packages = [ + "extra-hatch-configuration/requirements-sql-client-packages.txt" +] +trino-sql-client-packages = [ + "extra-hatch-configuration/requirements-trino-sql-client-packages.txt" +] # There are files that hatch will always include as well (e.g. the LICENSE file). # See hatch build docs for more details. @@ -96,16 +96,9 @@ packages = ["metricflow", "metricflow-semantics/metricflow_semantics"] # Environment setup -# Due to our current wonky package organization, we need to do an editable install -# of dbt-metricflow in every test running environment in order for the tests to work. -# In theory we can install the adapter extra for dbt-metricflow and rely on that, but -# for ease of managing versioning through upgrade phases we retain the explicit -# dependencies on the specific adapter versions defined here. - [tool.hatch.envs.dev-env] description = "Environment for development. Includes a DuckDB-backed client." run = "run-coverage --no-cov" -dependencies = ["metricflow-semantics @ {root:uri}/metricflow-semantics"] features = [ "dev-packages", @@ -118,11 +111,11 @@ MF_TEST_ADAPTER_TYPE="duckdb" MF_SQL_ENGINE_URL="duckdb://" # This allows us to use the classes in the `dbt-metricflow` package for tests without installing the package. # `dbt-metricflow` can't be installed as it has `metricflow` as a dependency. -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" [tool.hatch.envs.postgres-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_SQL_ENGINE_URL="postgresql://metricflow@localhost:5432/metricflow" MF_SQL_ENGINE_PASSWORD="metricflowing" MF_TEST_ADAPTER_TYPE="postgres" @@ -141,7 +134,7 @@ features = [ # configured independently of the hatch env construction [tool.hatch.envs.bigquery-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="bigquery" [tool.hatch.envs.bigquery-env] @@ -155,7 +148,7 @@ features = [ [tool.hatch.envs.databricks-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="databricks" @@ -170,7 +163,7 @@ features = [ [tool.hatch.envs.redshift-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="redshift" [tool.hatch.envs.redshift-env] @@ -184,7 +177,7 @@ features = [ [tool.hatch.envs.snowflake-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE="snowflake" [tool.hatch.envs.snowflake-env] @@ -198,7 +191,7 @@ features = [ [tool.hatch.envs.trino-env.env-vars] -PYTHONPATH="./dbt-metricflow" +PYTHONPATH="metricflow-semantics:dbt-metricflow" MF_TEST_ADAPTER_TYPE = "trino" MF_SQL_ENGINE_URL = "trino://trino@localhost:8080/" DBT_ENV_SECRET_CATALOG="memory"