Skip to content

Commit 2cc72dc

Browse files
committed
continue on failure for intersystems driver
1 parent 5f10c05 commit 2cc72dc

File tree

6 files changed

+78
-21
lines changed

6 files changed

+78
-21
lines changed

.github/workflows/python-publish.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,19 @@ jobs:
4949
run: |
5050
pip install tox
5151
- name: Run Tests
52+
continue-on-error: true
5253
run: |
5354
docker exec iris iris session iris -U%SYS '##class(Security.Users).UnExpireUserPasswords("*")'
54-
tox -e py312-${{ matrix.engine }}-${{ matrix.driver }} -- --dburi iris+${{ matrix.driver }}://_SYSTEM:SYS@localhost:1972/USER
55+
tox -e py312-${{ matrix.engine }}-${{ matrix.driver }} -- --dburi iris+${{ matrix.driver }}://_SYSTEM:SYS@localhost:1972/USER --junit-xml=test-results.xml
56+
- name: Surface failing tests
57+
if: always()
58+
uses: pmeier/pytest-results-action@main
59+
with:
60+
path: test-results.xml
61+
summary: true
62+
display-options: fEX
63+
fail-on-empty: false
64+
title: Test results
5565
deploy:
5666
needs: test
5767
if: github.event_name != 'pull_request'

requirements-dev.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ pytest
44
# black
55
# twine
66
alembic
7-
testcontainers-iris
7+
testcontainers-iris
8+
pytest-github-actions-annotate-failures

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ intersystems =
3333
intersystems-irispython==5.1.0
3434

3535
[tool:pytest]
36-
addopts= --tb native -v -r fxX --maxfail=25 -p no:warnings
36+
addopts= --tb native -v -r fxX -p no:warnings
3737

3838
[db]
3939
default=iris://_SYSTEM:SYS@localhost:1972/USER

sqlalchemy_iris/base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -971,11 +971,9 @@ def on_connect(conn):
971971

972972
def _get_option(self, connection, option):
973973
with connection.cursor() as cursor:
974-
cursor.execute("SELECT %SYSTEM_SQL.Util_GetOption(?)", option)
974+
cursor.execute("SELECT %SYSTEM_SQL.Util_GetOption(?)", (option, ))
975975
row = cursor.fetchone()
976-
if row:
977-
return row[0]
978-
return None
976+
return row[0] if row else None
979977

980978
def _set_option(self, connection, option, value):
981979
with connection.cursor() as cursor:

sqlalchemy_iris/intersystems/__init__.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,11 @@ def fetchone(
5050
class InterSystemsExecutionContext(IRISExecutionContext):
5151
cursor_fetch_strategy = InterSystemsCursorFetchStrategy()
5252

53-
def create_cursor(self):
54-
cursor = self._dbapi_connection.cursor()
55-
cursor.sqlcode = 0
56-
return cursor
57-
5853

5954
class IRISDialect_intersystems(IRISDialect):
6055
driver = "intersystems"
6156

62-
execution_ctx_cls = InterSystemsExecutionContext
57+
# execution_ctx_cls = InterSystemsExecutionContext
6358

6459
supports_statement_cache = True
6560

@@ -148,14 +143,6 @@ def on_connect(conn):
148143
def _get_server_version_info(self, connection):
149144
return self.server_version
150145

151-
def _get_option(self, connection, option):
152-
with connection.cursor() as cursor:
153-
cursor.execute("SELECT %SYSTEM_SQL.Util_GetOption(?)", (option,))
154-
row = cursor.fetchone()
155-
if row:
156-
return row[0]
157-
return None
158-
159146
def set_isolation_level(self, connection, level_str):
160147
if level_str == "AUTOCOMMIT":
161148
connection.autocommit = True
@@ -166,6 +153,7 @@ def set_isolation_level(self, connection, level_str):
166153
with connection.cursor() as cursor:
167154
cursor.execute("SET TRANSACTION ISOLATION LEVEL " + level_str)
168155

156+
"""
169157
@remap_exception
170158
def do_execute(self, cursor, query, params, context=None):
171159
if query.endswith(";"):
@@ -182,5 +170,6 @@ def do_executemany(self, cursor, query, params, context=None):
182170
params = [param[0] if len(param) else None for param in params]
183171
cursor.executemany(query, params)
184172
173+
"""
185174

186175
dialect = IRISDialect_intersystems

testiris.py

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import iris
2+
3+
host = "localhost"
4+
port = 1972
5+
namespace = "USER"
6+
username = "_SYSTEM"
7+
password = "SYS"
8+
9+
conn = iris.connect(
10+
host,
11+
port,
12+
namespace,
13+
username,
14+
password,
15+
)
16+
17+
with conn.cursor() as cursor:
18+
cursor = conn.cursor()
19+
20+
res = cursor.execute("DROP TABLE IF EXISTS test")
21+
res = cursor.execute(
22+
"""
23+
CREATE TABLE test (
24+
id IDENTITY NOT NULL,
25+
value VARCHAR(50)
26+
) WITH %CLASSPARAMETER ALLOWIDENTITYINSERT = 1
27+
"""
28+
)
29+
30+
cursor = conn.cursor()
31+
res = cursor.executemany(
32+
"INSERT INTO test (id, value) VALUES (?, ?)", [
33+
(1, 'val1'),
34+
(2, 'val2'),
35+
(3, 'val3'),
36+
(4, 'val4'),
37+
]
38+
)
39+
print(res)
40+
41+
# # cursor = conn.cursor()
42+
# # res = cursor.executemany(
43+
# # "INSERT INTO test DEFAULT VALUES", [
44+
# # None,
45+
# # None,
46+
# # None,
47+
# # None,
48+
# # ]
49+
# # )
50+
51+
res = cursor.executemany(
52+
"INSERT INTO test (value) VALUES (?)", [
53+
'val1',
54+
'val2',
55+
'val3',
56+
'val4',
57+
]
58+
)
59+
# print("res", res)

0 commit comments

Comments
 (0)