Skip to content

Commit b00652a

Browse files
committed
updated to 3.12
1 parent 4847ee2 commit b00652a

File tree

12 files changed

+150
-29
lines changed

12 files changed

+150
-29
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 5 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: |
@@ -70,7 +70,7 @@ jobs:
7070
7171
- name: Run Tests
7272
run: |
73-
tox -e py38,py39,py310,py311
73+
tox -e py39,py310,py311,py312
7474
7575
- name: Run pre-commit hooks
7676
run: pre-commit run --all-files --show-diff-on-failure
@@ -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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99

1010

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

dbt/adapters/iris/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = "1.8.19"
1+
version = "1.9.2"

dbt/adapters/iris/connections.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
from typing import Optional, Tuple, Any
2+
from typing import Optional, Tuple, Any, Type
33
from contextlib import contextmanager
44
from dataclasses import dataclass
55
from dbt.exceptions import DbtRuntimeError
@@ -142,7 +142,8 @@ def add_query(
142142
auto_begin: bool = True,
143143
bindings: Optional[Any] = None,
144144
abridge_sql_log: bool = False,
145-
many=False,
145+
retryable_exceptions: Tuple[Type[Exception], ...] = tuple(),
146+
retry_limit: int = 1,
146147
) -> Tuple[Connection, Any]:
147148
connection = self.get_thread_connection()
148149
if auto_begin and connection.transaction_open is False:

dbt/adapters/iris/impl.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ def list_relations_without_caching(self, schema_relation: IRISRelation) -> List[
8383
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME, kwargs=kwargs)
8484
except DbtRuntimeError as e:
8585
errmsg = getattr(e, "msg", "")
86-
if f"IRIS schema '{schema_relation}' not found" in errmsg:
87-
return []
88-
else:
86+
if f"IRIS schema '{schema_relation}' not found" not in errmsg:
8987
description = "Error while retrieving information about"
9088
logger.debug(f"{description} {schema_relation}: {e.msg}")
91-
return []
89+
return []
9290

9391
relations = []
9492
_database = schema_relation.database

requirements-dev.txt

Lines changed: 5 additions & 6 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
@@ -14,8 +14,6 @@ freezegun~=1.3
1414
ipdb~=0.13.13
1515
mypy==1.7.1 # patch updates have historically introduced breaking changes
1616
pip-tools~=7.3
17-
pre-commit~=3.5
18-
pre-commit-hooks~=4.5
1917
pytest~=7.4
2018
pytest-csv~=3.0
2119
pytest-dotenv~=0.5.2
@@ -30,3 +28,4 @@ twine~=4.0
3028
wheel~=0.42
3129

3230
testcontainers-iris
31+
pre-commit

requirements-iris.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/intersystems-community/intersystems-irispython/releases/download/3.7.9/intersystems_iris-3.7.9-py3-none-any.whl
1+
https://github.com/intersystems-community/intersystems-irispython/releases/download/3.8.0/intersystems_iris-3.8.0-py3-none-any.whl

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

0 commit comments

Comments
 (0)