Skip to content

Commit 8a44295

Browse files
committed
updated to 3.12
1 parent 4847ee2 commit 8a44295

File tree

8 files changed

+132
-18
lines changed

8 files changed

+132
-18
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ jobs:
5353
uses: actions/setup-python@v5
5454
with:
5555
python-version: |
56-
3.8
5756
3.9
5857
3.10
5958
3.11
59+
3.12
6060
6161
- name: Install python dependencies
6262
run: |
@@ -80,17 +80,17 @@ jobs:
8080
fail-fast: false
8181
matrix:
8282
image:
83-
- containers.intersystems.com/intersystems/iris-community:latest-em
83+
- containers.intersystems.com/intersystems/iris-community:latest-cd
8484
- containers.intersystems.com/intersystems/iris-community:latest-preview
8585
python:
86-
- name: py38
87-
version: "3.8"
8886
- name: py39
8987
version: "3.9"
9088
- name: py310
9189
version: "3.10"
9290
- name: py311
9391
version: "3.11"
92+
- name: py312
93+
version: "3.12"
9494
runs-on: ubuntu-latest
9595

9696
steps:

.python-version

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
3.8
2-
3.9
3-
3.10
4-
3.11
1+
3.12

dbt/adapters/iris/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010

1111
Plugin = AdapterPlugin(
12-
adapter=IRISAdapter, credentials=IRISCredentials, include_path=iris.PACKAGE_PATH # type: ignore
12+
adapter=IRISAdapter, credentials=IRISCredentials, include_path=iris.PACKAGE_PATH
1313
)

dbt/adapters/iris/impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def check_schema_exists(self, database, schema):
7777
exists = True if schema in [row[0] for row in results] else False
7878
return exists
7979

80-
def list_relations_without_caching(self, schema_relation: IRISRelation) -> List[IRISRelation]: # type: ignore
80+
def list_relations_without_caching(self, schema_relation: IRISRelation) -> List[IRISRelation]:
8181
kwargs = {"schema_relation": schema_relation}
8282
try:
8383
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME, kwargs=kwargs)

requirements-dev.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# install latest changes in dbt-core
2-
git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core
3-
git+https://github.com/dbt-labs/dbt-common.git
4-
git+https://github.com/dbt-labs/dbt-adapters.git
5-
git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter
2+
dbt-common @ git+https://github.com/dbt-labs/dbt-common.git
3+
dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter
4+
dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#egg=dbt-core&subdirectory=core
5+
dbt-adapters @ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-adapters
66

77
black>=24.3
88
bumpversion~=0.6.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ def _dbt_iris_version() -> str:
5454
"Programming Language :: Python :: 3.10",
5555
"Programming Language :: Python :: 3.11",
5656
],
57-
python_requires=">3.7,<3.12",
57+
python_requires=">3.7",
5858
)
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import pytest
2+
3+
from dbt.tests.util import run_dbt, check_relations_equal
4+
from dbt.tests.fixtures.project import write_project_files
5+
6+
7+
tests__get_columns_in_relation_sql = """
8+
{% set columns = adapter.get_columns_in_relation(ref('model')) %}
9+
{% set limit_query = 0 %}
10+
{% if (columns | length) == 0 %}
11+
{% set limit_query = 1 %}
12+
{% endif %}
13+
14+
select 1 as id limit {{ limit_query }}
15+
16+
"""
17+
18+
models__upstream_sql = """
19+
select 1 as id
20+
21+
"""
22+
23+
models__expected_sql = """
24+
-- make sure this runs after 'model'
25+
-- {{ ref('model') }}
26+
select 2 as id
27+
28+
"""
29+
30+
models__model_sql = """
31+
32+
{% set upstream = ref('upstream') %}
33+
34+
{% if execute %}
35+
{# don't ever do any of this #}
36+
{%- do adapter.drop_schema(upstream) -%}
37+
{% set existing = adapter.get_relation(upstream.database, upstream.schema, upstream.identifier) %}
38+
{% if existing is not none %}
39+
{% do exceptions.raise_compiler_error('expected ' ~ ' to not exist, but it did') %}
40+
{% endif %}
41+
42+
{%- do adapter.create_schema(upstream) -%}
43+
44+
{% set sql = create_view_as(upstream, 'select 2 as id') %}
45+
{% do run_query(sql) %}
46+
{% endif %}
47+
48+
49+
select * from {{ upstream }}
50+
51+
"""
52+
53+
54+
class BaseAdapterMethod:
55+
"""
56+
This test will leverage the following adapter methods:
57+
get_relation
58+
get_columns_in_relation
59+
drop_schema
60+
create_schema
61+
It will aims to make sure drop_shema actually works, for more context
62+
checkout #1983
63+
"""
64+
65+
@pytest.fixture(scope="class")
66+
def tests(self):
67+
return {"get_columns_in_relation.sql": tests__get_columns_in_relation_sql}
68+
69+
@pytest.fixture(scope="class")
70+
def models(self):
71+
return {
72+
"upstream.sql": models__upstream_sql,
73+
"expected.sql": models__expected_sql,
74+
"model.sql": models__model_sql,
75+
}
76+
77+
@pytest.fixture(scope="class")
78+
def project_files(
79+
self,
80+
project_root,
81+
tests,
82+
models,
83+
):
84+
write_project_files(project_root, "tests", tests)
85+
write_project_files(project_root, "models", models)
86+
87+
@pytest.fixture(scope="class")
88+
def project_config_update(self):
89+
return {
90+
"name": "adapter_methods",
91+
}
92+
93+
@pytest.fixture(autouse=True)
94+
def clean_up(self, project):
95+
yield
96+
with project.adapter.connection_named("__test"):
97+
relation = project.adapter.Relation.create(
98+
database=project.database, schema=project.test_schema
99+
)
100+
project.adapter.drop_schema(relation)
101+
102+
pass
103+
104+
# snowflake need all tables in CAP name
105+
@pytest.fixture(scope="class")
106+
def equal_tables(self):
107+
return ["model", "expected"]
108+
109+
def test_adapter_methods(self, project, equal_tables):
110+
run_dbt(["compile"]) # trigger any compile-time issues
111+
result = run_dbt()
112+
assert len(result) == 3
113+
check_relations_equal(project.adapter, equal_tables)
114+
115+
116+
class TestBaseCaching(BaseAdapterMethod):
117+
pass

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[tox]
22
skipsdist = True
3-
envlist = py3{8,9,10,11}{-iris,}
3+
envlist = py3{9,10,11,12}{-iris,}
44

5-
[testenv:{py37,py38,py39,py310}]
5+
[testenv:{py39,py310,py311,py312}]
66
description = unit testing
77
skip_install = True
88
passenv = DBT_*,PYTEST_ADOPTS
@@ -12,7 +12,7 @@ deps =
1212
-r requirements-dev.txt
1313
-e.
1414

15-
[testenv:py3{8,9,10,11}-iris]
15+
[testenv:py3{9,10,11,12}-iris]
1616
description = adapter plugin functional testing
1717
skip_install = true
1818
passenv = DBT_*,IRIS_TEST_*,PYTEST_ADOPTS

0 commit comments

Comments
 (0)