sqlalchemy-iris 0.13.4b4__py3-none-any.whl → 0.14.1b1__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 +3 -2
- sqlalchemy_iris/types.py +62 -55
- {sqlalchemy_iris-0.13.4b4.dist-info → sqlalchemy_iris-0.14.1b1.dist-info}/METADATA +1 -1
- {sqlalchemy_iris-0.13.4b4.dist-info → sqlalchemy_iris-0.14.1b1.dist-info}/RECORD +8 -8
- {sqlalchemy_iris-0.13.4b4.dist-info → sqlalchemy_iris-0.14.1b1.dist-info}/WHEEL +1 -1
- {sqlalchemy_iris-0.13.4b4.dist-info → sqlalchemy_iris-0.14.1b1.dist-info}/LICENSE +0 -0
- {sqlalchemy_iris-0.13.4b4.dist-info → sqlalchemy_iris-0.14.1b1.dist-info}/entry_points.txt +0 -0
- {sqlalchemy_iris-0.13.4b4.dist-info → sqlalchemy_iris-0.14.1b1.dist-info}/top_level.txt +0 -0
sqlalchemy_iris/base.py
CHANGED
@@ -91,7 +91,6 @@ from .types import IRISTime
|
|
91
91
|
from .types import IRISTimeStamp
|
92
92
|
from .types import IRISDate
|
93
93
|
from .types import IRISDateTime
|
94
|
-
from .types import IRISUniqueIdentifier
|
95
94
|
from .types import IRISListBuild # noqa
|
96
95
|
from .types import IRISVector # noqa
|
97
96
|
|
@@ -819,8 +818,10 @@ colspecs = {
|
|
819
818
|
sqltypes.DateTime: IRISDateTime,
|
820
819
|
sqltypes.TIMESTAMP: IRISTimeStamp,
|
821
820
|
sqltypes.Time: IRISTime,
|
822
|
-
sqltypes.UUID: IRISUniqueIdentifier,
|
823
821
|
}
|
822
|
+
if sqlalchemy_version.startswith("2."):
|
823
|
+
from .types import IRISUniqueIdentifier
|
824
|
+
colspecs[sqltypes.UUID] = IRISUniqueIdentifier
|
824
825
|
|
825
826
|
|
826
827
|
class IRISExact(ReturnTypeFromArgs):
|
sqlalchemy_iris/types.py
CHANGED
@@ -2,9 +2,10 @@ import datetime
|
|
2
2
|
from decimal import Decimal
|
3
3
|
from sqlalchemy import func, text
|
4
4
|
from sqlalchemy.sql import sqltypes
|
5
|
-
from sqlalchemy.types import UserDefinedType
|
5
|
+
from sqlalchemy.types import UserDefinedType
|
6
6
|
from uuid import UUID as _python_UUID
|
7
7
|
from intersystems_iris import IRISList
|
8
|
+
from sqlalchemy import __version__ as sqlalchemy_version
|
8
9
|
|
9
10
|
HOROLOG_ORDINAL = datetime.date(1840, 12, 31).toordinal()
|
10
11
|
|
@@ -134,73 +135,79 @@ class IRISTime(sqltypes.DateTime):
|
|
134
135
|
return process
|
135
136
|
|
136
137
|
|
137
|
-
|
138
|
-
def literal_processor(self, dialect):
|
139
|
-
if not self.as_uuid:
|
138
|
+
if sqlalchemy_version.startswith("2."):
|
140
139
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
return process
|
145
|
-
else:
|
146
|
-
|
147
|
-
def process(value):
|
148
|
-
return f"""'{str(value).replace("'", "''")}'"""
|
149
|
-
|
150
|
-
return process
|
151
|
-
|
152
|
-
def bind_processor(self, dialect):
|
153
|
-
character_based_uuid = not dialect.supports_native_uuid or not self.native_uuid
|
154
|
-
|
155
|
-
if character_based_uuid:
|
156
|
-
if self.as_uuid:
|
140
|
+
class IRISUniqueIdentifier(sqltypes.Uuid):
|
141
|
+
def literal_processor(self, dialect):
|
142
|
+
if not self.as_uuid:
|
157
143
|
|
158
144
|
def process(value):
|
159
|
-
|
160
|
-
value = str(value)
|
161
|
-
return value
|
145
|
+
return f"""'{value.replace("'", "''")}'"""
|
162
146
|
|
163
147
|
return process
|
164
148
|
else:
|
165
149
|
|
166
150
|
def process(value):
|
167
|
-
return value
|
151
|
+
return f"""'{str(value).replace("'", "''")}'"""
|
168
152
|
|
169
153
|
return process
|
170
|
-
else:
|
171
|
-
return None
|
172
154
|
|
173
|
-
|
174
|
-
|
155
|
+
def bind_processor(self, dialect):
|
156
|
+
character_based_uuid = (
|
157
|
+
not dialect.supports_native_uuid or not self.native_uuid
|
158
|
+
)
|
175
159
|
|
176
|
-
|
177
|
-
|
160
|
+
if character_based_uuid:
|
161
|
+
if self.as_uuid:
|
178
162
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
163
|
+
def process(value):
|
164
|
+
if value is not None:
|
165
|
+
value = str(value)
|
166
|
+
return value
|
183
167
|
|
184
|
-
|
168
|
+
return process
|
169
|
+
else:
|
170
|
+
|
171
|
+
def process(value):
|
172
|
+
return value
|
173
|
+
|
174
|
+
return process
|
185
175
|
else:
|
176
|
+
return None
|
186
177
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
178
|
+
def result_processor(self, dialect, coltype):
|
179
|
+
character_based_uuid = (
|
180
|
+
not dialect.supports_native_uuid or not self.native_uuid
|
181
|
+
)
|
191
182
|
|
192
|
-
|
193
|
-
|
194
|
-
if not self.as_uuid:
|
183
|
+
if character_based_uuid:
|
184
|
+
if self.as_uuid:
|
195
185
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
186
|
+
def process(value):
|
187
|
+
if value and not isinstance(value, _python_UUID):
|
188
|
+
value = _python_UUID(value)
|
189
|
+
return value
|
200
190
|
|
201
|
-
|
191
|
+
return process
|
192
|
+
else:
|
193
|
+
|
194
|
+
def process(value):
|
195
|
+
if value and isinstance(value, _python_UUID):
|
196
|
+
value = str(value)
|
197
|
+
return value
|
198
|
+
|
199
|
+
return process
|
202
200
|
else:
|
203
|
-
|
201
|
+
if not self.as_uuid:
|
202
|
+
|
203
|
+
def process(value):
|
204
|
+
if value and isinstance(value, _python_UUID):
|
205
|
+
value = str(value)
|
206
|
+
return value
|
207
|
+
|
208
|
+
return process
|
209
|
+
else:
|
210
|
+
return None
|
204
211
|
|
205
212
|
|
206
213
|
class IRISListBuild(UserDefinedType):
|
@@ -267,9 +274,7 @@ class IRISVector(UserDefinedType):
|
|
267
274
|
item_type_server = (
|
268
275
|
"decimal"
|
269
276
|
if self.item_type is float
|
270
|
-
else "float"
|
271
|
-
if self.item_type is Decimal
|
272
|
-
else "int"
|
277
|
+
else "float" if self.item_type is Decimal else "int"
|
273
278
|
)
|
274
279
|
self.item_type_server = item_type_server
|
275
280
|
|
@@ -304,19 +309,21 @@ class IRISVector(UserDefinedType):
|
|
304
309
|
# return self.func('vector_l2', other)
|
305
310
|
|
306
311
|
def max_inner_product(self, other):
|
307
|
-
return self.func(
|
312
|
+
return self.func("vector_dot_product", other)
|
308
313
|
|
309
314
|
def cosine_distance(self, other):
|
310
|
-
return self.func(
|
315
|
+
return self.func("vector_cosine", other)
|
311
316
|
|
312
317
|
def cosine(self, other):
|
313
|
-
return
|
318
|
+
return 1 - self.func("vector_cosine", other)
|
314
319
|
|
315
320
|
def func(self, funcname: str, other):
|
316
321
|
if not isinstance(other, list) and not isinstance(other, tuple):
|
317
322
|
raise ValueError("expected list or tuple, got '%s'" % type(other))
|
318
323
|
othervalue = f"[{','.join([str(v) for v in other])}]"
|
319
|
-
return getattr(func, funcname)(
|
324
|
+
return getattr(func, funcname)(
|
325
|
+
self, func.to_vector(othervalue, text(self.type.item_type_server))
|
326
|
+
)
|
320
327
|
|
321
328
|
|
322
329
|
class BIT(sqltypes.TypeEngine):
|
@@ -69,17 +69,17 @@ irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
|
|
69
69
|
irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
|
70
70
|
sqlalchemy_iris/__init__.py,sha256=2bckDQ0AJJ9DfuAc20VVQNiK-YBhpYJMdo_C0qJwPHQ,1183
|
71
71
|
sqlalchemy_iris/alembic.py,sha256=IhZP6P-whMrXzD8lTCKvIC6EK8hKW88JTNG_U8t2quk,6373
|
72
|
-
sqlalchemy_iris/base.py,sha256=
|
72
|
+
sqlalchemy_iris/base.py,sha256=4YkWnDZ3TKh6URgswDYn1EHSY7Y9W54fi91nQiWwoAM,52363
|
73
73
|
sqlalchemy_iris/embedded.py,sha256=5WZ78PIYB_pPyaLrK4E7kHUsGBRiwzYHjsTDiNYHUGg,819
|
74
74
|
sqlalchemy_iris/information_schema.py,sha256=Ei1gAHXn4fWpvmUzwf-2hGslU458uQXFt1s0r1NAj2Y,6132
|
75
75
|
sqlalchemy_iris/iris.py,sha256=Of0Ruc9W2c5ll5sjAy1xRo4tf1m0l_ab0vAdacTv3Yw,276
|
76
76
|
sqlalchemy_iris/irisasync.py,sha256=7Kmso-RGjxQi9Y4x-zQaUk1ylDQ7TDvpvlZh_syJtGw,312
|
77
77
|
sqlalchemy_iris/provision.py,sha256=drorbIgNO770Ws0XiCRXY_sDbQGIy2_zzNK3KYrDetY,198
|
78
78
|
sqlalchemy_iris/requirements.py,sha256=2MPADPOk3qvXCyr7xXvkl_MfkE8v75Z3yGJO0RbzRog,7560
|
79
|
-
sqlalchemy_iris/types.py,sha256=
|
80
|
-
sqlalchemy_iris-0.
|
81
|
-
sqlalchemy_iris-0.
|
82
|
-
sqlalchemy_iris-0.
|
83
|
-
sqlalchemy_iris-0.
|
84
|
-
sqlalchemy_iris-0.
|
85
|
-
sqlalchemy_iris-0.
|
79
|
+
sqlalchemy_iris/types.py,sha256=Bp2hM7HTbO6DguN7Ua4eTl2thY3SZZKiV7JG_VUItwg,10981
|
80
|
+
sqlalchemy_iris-0.14.1b1.dist-info/LICENSE,sha256=RQmigqltsLq8lfOBc_KwtL0gkODyUCNpU-0ZiZwGlho,1075
|
81
|
+
sqlalchemy_iris-0.14.1b1.dist-info/METADATA,sha256=hw7PjnmQMAEaSLmqWd6iBzHqjm7aP00vcJ2WYOrGXJU,2357
|
82
|
+
sqlalchemy_iris-0.14.1b1.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
|
83
|
+
sqlalchemy_iris-0.14.1b1.dist-info/entry_points.txt,sha256=zjOwyJPXHsNAeQP0n6l2_pav2U__rTAiS_Bk_IEmSlU,184
|
84
|
+
sqlalchemy_iris-0.14.1b1.dist-info/top_level.txt,sha256=mjpHqFjekbB1TWr3xI3o4AqN3Spby-_uqyuSSeBDmuw,50
|
85
|
+
sqlalchemy_iris-0.14.1b1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|