From 85862a1ee25ab727b0375284987cdb6c861976ff Mon Sep 17 00:00:00 2001 From: Josh Wills Date: Wed, 25 Sep 2024 17:35:15 -0700 Subject: [PATCH 1/3] Update the versions of Python we run tests against from 3.9 through 3.12 --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4cd7128..67ed99ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] env: TOXENV: "unit" @@ -118,7 +118,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] env: TOXENV: "functional" @@ -163,7 +163,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] env: TOXENV: "filebased" @@ -445,7 +445,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - name: Set up Python ${{ matrix.python-version }} From 1e838136c66e7264c1f53f48a163eb55c051112e Mon Sep 17 00:00:00 2001 From: Josh Wills Date: Thu, 26 Sep 2024 15:23:55 -0700 Subject: [PATCH 2/3] Try out this hack --- dbt/adapters/duckdb/impl.py | 13 +++++++++++-- dev-requirements.txt | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dbt/adapters/duckdb/impl.py b/dbt/adapters/duckdb/impl.py index 28054658..d4e797ad 100644 --- a/dbt/adapters/duckdb/impl.py +++ b/dbt/adapters/duckdb/impl.py @@ -237,8 +237,17 @@ def render_column_constraint(cls, constraint: ColumnLevelConstraint) -> Optional """Render the given constraint as DDL text. Should be overriden by adapters which need custom constraint rendering.""" if constraint.type == ConstraintType.foreign_key: - # DuckDB doesn't support 'foreign key' as an alias - return f"references {constraint.expression}" + if constraint.to and constraint.to_columns: + # TODO: this is a hack to get around a limitation in DuckDB around setting FKs + # across databases. + pieces = constraint.to.split(".") + if len(pieces) > 2: + constraint_to = ".".join(pieces[1:]) + else: + constraint_to = constraint.to + return f"references {constraint_to} ({', '.join(constraint.to_columns)})" + else: + return f"references {constraint.expression}" else: return super().render_column_constraint(constraint) diff --git a/dev-requirements.txt b/dev-requirements.txt index 657adfd3..9c99bc03 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,8 @@ # install latest changes in dbt-core + dbt-tests-adapter -# git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core -# git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter +git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core +git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter -dbt-tests-adapter==1.9.2 +#dbt-tests-adapter==1.9.2 boto3 mypy-boto3-glue From 020e0ee42385d55b7302d36f249423b8d10575c4 Mon Sep 17 00:00:00 2001 From: Josh Wills Date: Thu, 26 Sep 2024 15:42:31 -0700 Subject: [PATCH 3/3] Put the dev-requirements back the way they were --- dev-requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 9c99bc03..657adfd3 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,8 @@ # install latest changes in dbt-core + dbt-tests-adapter -git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core -git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter +# git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core +# git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter -#dbt-tests-adapter==1.9.2 +dbt-tests-adapter==1.9.2 boto3 mypy-boto3-glue