sqlalchemy-iris 0.17.1b3__py3-none-any.whl → 0.17.1b4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sqlalchemy_iris/base.py CHANGED
@@ -971,11 +971,9 @@ There are no access to %Dictionary, may be required for some advanced features,
971
971
 
972
972
  def _get_option(self, connection, option):
973
973
  with connection.cursor() as cursor:
974
- cursor.execute("SELECT %SYSTEM_SQL.Util_GetOption(?)", option)
974
+ cursor.execute("SELECT %SYSTEM_SQL.Util_GetOption(?)", (option, ))
975
975
  row = cursor.fetchone()
976
- if row:
977
- return row[0]
978
- return None
976
+ return row[0] if row else None
979
977
 
980
978
  def _set_option(self, connection, option, value):
981
979
  with connection.cursor() as cursor:
@@ -1091,10 +1089,7 @@ There are no access to %Dictionary, may be required for some advanced features,
1091
1089
  if query.endswith(";"):
1092
1090
  query = query[:-1]
1093
1091
  self._debug(query, params)
1094
- try:
1095
- cursor.execute(query, params)
1096
- except Exception as ex:
1097
- raise ex
1092
+ cursor.execute(query, params)
1098
1093
 
1099
1094
  def do_executemany(self, cursor, query, params, context=None):
1100
1095
  if query.endswith(";"):
@@ -1,11 +1,11 @@
1
1
  import re
2
+ from typing import Any
2
3
  from ..base import IRISDialect
3
- from sqlalchemy import text, util
4
4
  from ..base import IRISExecutionContext
5
5
  from . import dbapi
6
- from .dbapi import connect, Cursor
7
- from .cursor import InterSystemsCursorFetchStrategy
6
+ from .dbapi import connect
8
7
  from .dbapi import IntegrityError, OperationalError, DatabaseError
8
+ from sqlalchemy.engine.cursor import CursorFetchStrategy
9
9
 
10
10
 
11
11
  def remap_exception(func):
@@ -19,7 +19,7 @@ def remap_exception(func):
19
19
  except RuntimeError as ex:
20
20
  # [SQLCODE: <-119>:...
21
21
  message = ex.args[0]
22
- if '<LIST ERROR>' in message:
22
+ if "<LIST ERROR>" in message:
23
23
  # just random error happens in the driver, try again
24
24
  continue
25
25
  sqlcode = re.findall(r"^\[SQLCODE: <(-\d+)>:", message)
@@ -27,27 +27,34 @@ def remap_exception(func):
27
27
  raise Exception(message)
28
28
  sqlcode = int(sqlcode[0])
29
29
  if abs(sqlcode) in [108, 119, 121, 122]:
30
- raise IntegrityError(message)
30
+ raise IntegrityError(sqlcode, message)
31
31
  if abs(sqlcode) in [1, 12]:
32
- raise OperationalError(message)
33
- raise DatabaseError(message)
32
+ raise OperationalError(sqlcode, message)
33
+ raise DatabaseError(sqlcode, message)
34
34
 
35
35
  return wrapper
36
36
 
37
37
 
38
+ class InterSystemsCursorFetchStrategy(CursorFetchStrategy):
39
+
40
+ def fetchone(
41
+ self,
42
+ result,
43
+ dbapi_cursor,
44
+ hard_close: bool = False,
45
+ ) -> Any:
46
+ row = dbapi_cursor.fetchone()
47
+ return tuple(row) if row else None
48
+
49
+
38
50
  class InterSystemsExecutionContext(IRISExecutionContext):
39
51
  cursor_fetch_strategy = InterSystemsCursorFetchStrategy()
40
52
 
41
- def create_cursor(self):
42
- cursor = self._dbapi_connection.cursor()
43
- cursor.sqlcode = 0
44
- return cursor
45
-
46
53
 
47
54
  class IRISDialect_intersystems(IRISDialect):
48
55
  driver = "intersystems"
49
56
 
50
- execution_ctx_cls = InterSystemsExecutionContext
57
+ # execution_ctx_cls = InterSystemsExecutionContext
51
58
 
52
59
  supports_statement_cache = True
53
60
 
@@ -123,23 +130,19 @@ class IRISDialect_intersystems(IRISDialect):
123
130
  if super_ is not None:
124
131
  super_(conn)
125
132
 
126
- server_version = dbapi.createIRIS(conn).classMethodValue("%SYSTEM.Version", "GetNumber")
133
+ server_version = dbapi.createIRIS(conn).classMethodValue(
134
+ "%SYSTEM.Version", "GetNumber"
135
+ )
127
136
  server_version = server_version.split(".")
128
- self.server_version = tuple([int("".join(filter(str.isdigit, v))) for v in server_version])
137
+ self.server_version = tuple(
138
+ [int("".join(filter(str.isdigit, v))) for v in server_version]
139
+ )
129
140
 
130
141
  return on_connect
131
142
 
132
143
  def _get_server_version_info(self, connection):
133
144
  return self.server_version
134
145
 
135
- def _get_option(self, connection, option):
136
- with connection.cursor() as cursor:
137
- cursor.execute("SELECT %SYSTEM_SQL.Util_GetOption(?)", (option,))
138
- row = cursor.fetchone()
139
- if row:
140
- return row[0]
141
- return None
142
-
143
146
  def set_isolation_level(self, connection, level_str):
144
147
  if level_str == "AUTOCOMMIT":
145
148
  connection.autocommit = True
@@ -150,6 +153,7 @@ class IRISDialect_intersystems(IRISDialect):
150
153
  with connection.cursor() as cursor:
151
154
  cursor.execute("SET TRANSACTION ISOLATION LEVEL " + level_str)
152
155
 
156
+ """
153
157
  @remap_exception
154
158
  def do_execute(self, cursor, query, params, context=None):
155
159
  if query.endswith(";"):
@@ -166,5 +170,6 @@ class IRISDialect_intersystems(IRISDialect):
166
170
  params = [param[0] if len(param) else None for param in params]
167
171
  cursor.executemany(query, params)
168
172
 
173
+ """
169
174
 
170
175
  dialect = IRISDialect_intersystems
@@ -960,8 +960,8 @@ class Requirements(SuiteRequirements, AlembicRequirements):
960
960
  literal string, e.g. via the TypeEngine.literal_processor() method.
961
961
 
962
962
  """
963
-
964
- return exclusions.open()
963
+ # works stable only on Community driver
964
+ return self.community_driver
965
965
 
966
966
  @property
967
967
  def datetime(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sqlalchemy-iris
3
- Version: 0.17.1b3
3
+ Version: 0.17.1b4
4
4
  Summary: InterSystems IRIS for SQLAlchemy
5
5
  Home-page: https://github.com/caretdev/sqlalchemy-iris
6
6
  Maintainer: CaretDev
@@ -65,20 +65,19 @@ irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
65
65
  irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
66
66
  sqlalchemy_iris/__init__.py,sha256=79niafYbL1XOw3eJfu0KwrHfP8CIb2I4HdN4B9PI_sQ,1297
67
67
  sqlalchemy_iris/alembic.py,sha256=L58qBIj6HwLmtU6FS5RXKW0gHr1mNTrBSChEllSh1n0,6607
68
- sqlalchemy_iris/base.py,sha256=nvGT7Fu8PogLItm0CwM9Mkmxp2_GzogHw7W1KUSKAMM,54562
68
+ sqlalchemy_iris/base.py,sha256=c9YpMQMFa6bgWg_z5BS3NskboYdKto9by0FeAe8qVWE,54469
69
69
  sqlalchemy_iris/embedded.py,sha256=5WZ78PIYB_pPyaLrK4E7kHUsGBRiwzYHjsTDiNYHUGg,819
70
70
  sqlalchemy_iris/information_schema.py,sha256=FUL3z_viGjjOvDA71Mbk5k94dUGcLV4dW1xHxBgM1rk,6188
71
71
  sqlalchemy_iris/iris.py,sha256=Of0Ruc9W2c5ll5sjAy1xRo4tf1m0l_ab0vAdacTv3Yw,276
72
72
  sqlalchemy_iris/irisasync.py,sha256=7Kmso-RGjxQi9Y4x-zQaUk1ylDQ7TDvpvlZh_syJtGw,312
73
73
  sqlalchemy_iris/provision.py,sha256=drorbIgNO770Ws0XiCRXY_sDbQGIy2_zzNK3KYrDetY,198
74
- sqlalchemy_iris/requirements.py,sha256=Xxk8eGmXHUQoz3a8Hg8UxebJ-bdJYhCazrcaJTgWzOE,44393
74
+ sqlalchemy_iris/requirements.py,sha256=9Klyec0qS2MHEaXbONauP7FUF5bi__vfsBrwOEKKTYg,44444
75
75
  sqlalchemy_iris/types.py,sha256=M5uyeANVN6MU40kiWBePGTCnVaAAKmfLOHq7zuJ0z6A,12024
76
- sqlalchemy_iris/intersystems/__init__.py,sha256=LFMRKPMTEFSbnlIUyXLQuz6E5X1UAFJf107I_VEw6-Y,5506
77
- sqlalchemy_iris/intersystems/cursor.py,sha256=I6hICJqlpomXpvE3fx0JWQwTlD6-GQi9cHxa4PAzGZM,464
76
+ sqlalchemy_iris/intersystems/__init__.py,sha256=J1WcKKAfEASHTmxCav_sGQeb2GE-FXgrgWnUDY8zMag,5463
78
77
  sqlalchemy_iris/intersystems/dbapi.py,sha256=JOPjpXrD_cwCzAwnO9cRwBtv2SM8YbczOk8PFX3oM_4,899
79
- sqlalchemy_iris-0.17.1b3.dist-info/LICENSE,sha256=RQmigqltsLq8lfOBc_KwtL0gkODyUCNpU-0ZiZwGlho,1075
80
- sqlalchemy_iris-0.17.1b3.dist-info/METADATA,sha256=gHWh-UOSV6T-3bUUHoNjUabiVQJqWbt4JT6e6WOJzmc,2946
81
- sqlalchemy_iris-0.17.1b3.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
82
- sqlalchemy_iris-0.17.1b3.dist-info/entry_points.txt,sha256=sYU1YvyyeGqOVVMpHySThfEhrVQL1lUVz5rDwmwCj7E,258
83
- sqlalchemy_iris-0.17.1b3.dist-info/top_level.txt,sha256=QRY18YUXUJrRde4aayj_brj0lr2LBRVZS1ZoVoDFVS0,45
84
- sqlalchemy_iris-0.17.1b3.dist-info/RECORD,,
78
+ sqlalchemy_iris-0.17.1b4.dist-info/LICENSE,sha256=RQmigqltsLq8lfOBc_KwtL0gkODyUCNpU-0ZiZwGlho,1075
79
+ sqlalchemy_iris-0.17.1b4.dist-info/METADATA,sha256=B0C1zKjsivRVcY7SyfEfX0D4BgcOqJuWcfimn4g9dwk,2946
80
+ sqlalchemy_iris-0.17.1b4.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
81
+ sqlalchemy_iris-0.17.1b4.dist-info/entry_points.txt,sha256=sYU1YvyyeGqOVVMpHySThfEhrVQL1lUVz5rDwmwCj7E,258
82
+ sqlalchemy_iris-0.17.1b4.dist-info/top_level.txt,sha256=QRY18YUXUJrRde4aayj_brj0lr2LBRVZS1ZoVoDFVS0,45
83
+ sqlalchemy_iris-0.17.1b4.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- from typing import Any
2
- from sqlalchemy import CursorResult
3
- from sqlalchemy.engine.cursor import CursorFetchStrategy
4
- from sqlalchemy.engine.interfaces import DBAPICursor
5
-
6
-
7
- class InterSystemsCursorFetchStrategy(CursorFetchStrategy):
8
-
9
- def fetchone(
10
- self,
11
- result: CursorResult[Any],
12
- dbapi_cursor: DBAPICursor,
13
- hard_close: bool = False,
14
- ) -> Any:
15
- row = dbapi_cursor.fetchone()
16
- return tuple(row) if row else None
17
-