sqlalchemy-iris 0.14.0__tar.gz → 0.14.1b2__tar.gz

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.
Files changed (92) hide show
  1. {sqlalchemy_iris-0.14.0/sqlalchemy_iris.egg-info → sqlalchemy_iris-0.14.1b2}/PKG-INFO +1 -1
  2. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/setup.cfg +1 -1
  3. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/base.py +3 -2
  4. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/types.py +62 -55
  5. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2/sqlalchemy_iris.egg-info}/PKG-INFO +1 -1
  6. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/tests/test_suite.py +155 -147
  7. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/LICENSE +0 -0
  8. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/README.md +0 -0
  9. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_BufferReader.py +0 -0
  10. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_BufferWriter.py +0 -0
  11. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_ConnectionInformation.py +0 -0
  12. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_ConnectionParameters.py +0 -0
  13. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_Constant.py +0 -0
  14. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_DBList.py +0 -0
  15. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_Device.py +0 -0
  16. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_GatewayContext.py +0 -0
  17. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_GatewayException.py +0 -0
  18. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_GatewayUtility.py +0 -0
  19. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRIS.py +0 -0
  20. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISConnection.py +0 -0
  21. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISEmbedded.py +0 -0
  22. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISGlobalNode.py +0 -0
  23. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISGlobalNodeView.py +0 -0
  24. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISIterator.py +0 -0
  25. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISList.py +0 -0
  26. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISNative.py +0 -0
  27. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISOREF.py +0 -0
  28. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISObject.py +0 -0
  29. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_IRISReference.py +0 -0
  30. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_InStream.py +0 -0
  31. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_LegacyIterator.py +0 -0
  32. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_ListItem.py +0 -0
  33. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_ListReader.py +0 -0
  34. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_ListWriter.py +0 -0
  35. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_LogFileStream.py +0 -0
  36. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_MessageHeader.py +0 -0
  37. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_OutStream.py +0 -0
  38. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_PrintStream.py +0 -0
  39. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_PythonGateway.py +0 -0
  40. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/_SharedMemorySocket.py +0 -0
  41. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/__init__.py +0 -0
  42. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/__main__.py +0 -0
  43. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_Column.py +0 -0
  44. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_DBAPI.py +0 -0
  45. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_Descriptor.py +0 -0
  46. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_IRISStream.py +0 -0
  47. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_Message.py +0 -0
  48. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_Parameter.py +0 -0
  49. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_ParameterCollection.py +0 -0
  50. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_ResultSetRow.py +0 -0
  51. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/_SQLType.py +0 -0
  52. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/__init__.py +0 -0
  53. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/preparser/_PreParser.py +0 -0
  54. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/preparser/_Scanner.py +0 -0
  55. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/preparser/_Token.py +0 -0
  56. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/preparser/_TokenList.py +0 -0
  57. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/dbapi/preparser/__init__.py +0 -0
  58. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_BusinessHost.py +0 -0
  59. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_BusinessOperation.py +0 -0
  60. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_BusinessProcess.py +0 -0
  61. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_BusinessService.py +0 -0
  62. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_Common.py +0 -0
  63. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_Director.py +0 -0
  64. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_IRISBusinessOperation.py +0 -0
  65. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_IRISBusinessService.py +0 -0
  66. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_IRISInboundAdapter.py +0 -0
  67. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_IRISOutboundAdapter.py +0 -0
  68. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_InboundAdapter.py +0 -0
  69. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_Message.py +0 -0
  70. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/_OutboundAdapter.py +0 -0
  71. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/intersystems_iris/pex/__init__.py +0 -0
  72. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/iris/__init__.py +0 -0
  73. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/iris/__init__.pyi +0 -0
  74. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/iris/iris_ipm.py +0 -0
  75. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/iris/iris_ipm.pyi +0 -0
  76. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/irisnative/_IRISNative.py +0 -0
  77. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/irisnative/__init__.py +0 -0
  78. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/setup.py +0 -0
  79. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/__init__.py +0 -0
  80. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/alembic.py +0 -0
  81. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/embedded.py +0 -0
  82. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/information_schema.py +0 -0
  83. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/iris.py +0 -0
  84. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/irisasync.py +0 -0
  85. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/provision.py +0 -0
  86. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris/requirements.py +0 -0
  87. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris.egg-info/SOURCES.txt +0 -0
  88. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris.egg-info/dependency_links.txt +0 -0
  89. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris.egg-info/entry_points.txt +0 -0
  90. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris.egg-info/requires.txt +0 -0
  91. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/sqlalchemy_iris.egg-info/top_level.txt +0 -0
  92. {sqlalchemy_iris-0.14.0 → sqlalchemy_iris-0.14.1b2}/tests/test_alembic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlalchemy-iris
3
- Version: 0.14.0
3
+ Version: 0.14.1b2
4
4
  Summary: InterSystems IRIS for SQLAlchemy
5
5
  Home-page: https://github.com/caretdev/sqlalchemy-iris
6
6
  Maintainer: CaretDev
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = sqlalchemy-iris
3
- version = 0.14.0
3
+ version = 0.14.1b2
4
4
  description = InterSystems IRIS for SQLAlchemy
5
5
  long_description = file: README.md
6
6
  url = https://github.com/caretdev/sqlalchemy-iris
@@ -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):
@@ -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, Float
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
- class IRISUniqueIdentifier(sqltypes.Uuid):
138
- def literal_processor(self, dialect):
139
- if not self.as_uuid:
138
+ if sqlalchemy_version.startswith("2."):
140
139
 
141
- def process(value):
142
- return f"""'{value.replace("'", "''")}'"""
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
- if value is not None:
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
- def result_processor(self, dialect, coltype):
174
- character_based_uuid = not dialect.supports_native_uuid or not self.native_uuid
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
- if character_based_uuid:
177
- if self.as_uuid:
160
+ if character_based_uuid:
161
+ if self.as_uuid:
178
162
 
179
- def process(value):
180
- if value and not isinstance(value, _python_UUID):
181
- value = _python_UUID(value)
182
- return value
163
+ def process(value):
164
+ if value is not None:
165
+ value = str(value)
166
+ return value
183
167
 
184
- return process
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
- def process(value):
188
- if value and isinstance(value, _python_UUID):
189
- value = str(value)
190
- return value
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
- return process
193
- else:
194
- if not self.as_uuid:
183
+ if character_based_uuid:
184
+ if self.as_uuid:
195
185
 
196
- def process(value):
197
- if value and isinstance(value, _python_UUID):
198
- value = str(value)
199
- return value
186
+ def process(value):
187
+ if value and not isinstance(value, _python_UUID):
188
+ value = _python_UUID(value)
189
+ return value
200
190
 
201
- return process
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
- return None
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('vector_dot_product', other)
312
+ return self.func("vector_dot_product", other)
308
313
 
309
314
  def cosine_distance(self, other):
310
- return self.func('vector_cosine', other)
315
+ return self.func("vector_cosine", other)
311
316
 
312
317
  def cosine(self, other):
313
- return (1 - self.func('vector_cosine', other))
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)(self, func.to_vector(othervalue, text(self.type.item_type_server)))
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlalchemy-iris
3
- Version: 0.14.0
3
+ Version: 0.14.1b2
4
4
  Summary: InterSystems IRIS for SQLAlchemy
5
5
  Home-page: https://github.com/caretdev/sqlalchemy-iris
6
6
  Maintainer: CaretDev
@@ -4,9 +4,6 @@ from sqlalchemy.testing.suite import FetchLimitOffsetTest as _FetchLimitOffsetTe
4
4
  from sqlalchemy.testing.suite import CompoundSelectTest as _CompoundSelectTest
5
5
  from sqlalchemy.testing.suite import CTETest as _CTETest
6
6
  from sqlalchemy.testing.suite import DifficultParametersTest as _DifficultParametersTest
7
- from sqlalchemy.testing.suite import (
8
- BizarroCharacterFKResolutionTest as _BizarroCharacterFKResolutionTest,
9
- )
10
7
  from sqlalchemy.testing import fixtures
11
8
  from sqlalchemy.testing.assertions import eq_
12
9
  from sqlalchemy.testing import config
@@ -26,6 +23,8 @@ import pytest
26
23
 
27
24
  from sqlalchemy.testing.suite import * # noqa
28
25
 
26
+ from sqlalchemy import __version__ as sqlalchemy_version
27
+
29
28
 
30
29
  class CompoundSelectTest(_CompoundSelectTest):
31
30
  @pytest.mark.skip()
@@ -270,166 +269,175 @@ class IRISEnumTest(fixtures.TablesTest):
270
269
  )
271
270
 
272
271
 
273
- class BizarroCharacterFKResolutionTest(_BizarroCharacterFKResolutionTest):
274
- @testing.combinations(
275
- ("id",), ("(3)",), ("col%p",), ("[brack]",), argnames="columnname"
276
- )
277
- @testing.variation("use_composite", [True, False])
278
- @testing.combinations(
279
- ("plain",),
280
- # ("(2)",), not in IRIS
281
- ("per % cent",),
282
- ("[brackets]",),
283
- argnames="tablename",
272
+ if sqlalchemy_version.startswith("2."):
273
+ from sqlalchemy.testing.suite import (
274
+ BizarroCharacterFKResolutionTest as _BizarroCharacterFKResolutionTest,
284
275
  )
285
- def test_fk_ref(self, connection, metadata, use_composite, tablename, columnname):
286
- super().test_fk_ref(connection, metadata, use_composite, tablename, columnname)
287
-
288
276
 
289
- class IRISListBuildTest(fixtures.TablesTest):
290
- __backend__ = True
291
-
292
- @classmethod
293
- def define_tables(cls, metadata):
294
- Table(
295
- "data",
296
- metadata,
297
- Column("val", IRISListBuild(10, float)),
277
+ class BizarroCharacterFKResolutionTest(_BizarroCharacterFKResolutionTest):
278
+ @testing.combinations(
279
+ ("id",), ("(3)",), ("col%p",), ("[brack]",), argnames="columnname"
280
+ )
281
+ @testing.variation("use_composite", [True, False])
282
+ @testing.combinations(
283
+ ("plain",),
284
+ # ("(2)",), not in IRIS
285
+ ("per % cent",),
286
+ ("[brackets]",),
287
+ argnames="tablename",
298
288
  )
289
+ def test_fk_ref(
290
+ self, connection, metadata, use_composite, tablename, columnname
291
+ ):
292
+ super().test_fk_ref(
293
+ connection, metadata, use_composite, tablename, columnname
294
+ )
299
295
 
300
- @classmethod
301
- def fixtures(cls):
302
- return dict(
303
- data=(
304
- ("val",),
305
- ([1.0] * 50,),
306
- ([1.23] * 50,),
307
- ([i for i in range(0, 50)],),
308
- (None,),
296
+ class IRISListBuildTest(fixtures.TablesTest):
297
+ __backend__ = True
298
+
299
+ @classmethod
300
+ def define_tables(cls, metadata):
301
+ Table(
302
+ "data",
303
+ metadata,
304
+ Column("val", IRISListBuild(10, float)),
309
305
  )
310
- )
311
306
 
312
- def _assert_result(self, select, result):
313
- with config.db.connect() as conn:
314
- eq_(conn.execute(select).fetchall(), result)
307
+ @classmethod
308
+ def fixtures(cls):
309
+ return dict(
310
+ data=(
311
+ ("val",),
312
+ ([1.0] * 50,),
313
+ ([1.23] * 50,),
314
+ ([i for i in range(0, 50)],),
315
+ (None,),
316
+ )
317
+ )
315
318
 
316
- def test_listbuild(self):
317
- self._assert_result(
318
- select(self.tables.data),
319
- [
320
- ([1.0] * 50,),
321
- ([1.23] * 50,),
322
- ([i for i in range(0, 50)],),
323
- (None,),
324
- ],
325
- )
326
- self._assert_result(
327
- select(self.tables.data).where(self.tables.data.c.val == [1.0] * 50),
328
- [
329
- ([1.0] * 50,),
330
- ],
331
- )
319
+ def _assert_result(self, select, result):
320
+ with config.db.connect() as conn:
321
+ eq_(conn.execute(select).fetchall(), result)
332
322
 
333
- self._assert_result(
334
- select(
335
- self.tables.data,
336
- self.tables.data.c.val.func("$listsame", [1.0] * 50).label("same"),
337
- ).limit(1),
338
- [
339
- ([1.0] * 50, 1),
340
- ],
341
- )
323
+ def test_listbuild(self):
324
+ self._assert_result(
325
+ select(self.tables.data),
326
+ [
327
+ ([1.0] * 50,),
328
+ ([1.23] * 50,),
329
+ ([i for i in range(0, 50)],),
330
+ (None,),
331
+ ],
332
+ )
333
+ self._assert_result(
334
+ select(self.tables.data).where(self.tables.data.c.val == [1.0] * 50),
335
+ [
336
+ ([1.0] * 50,),
337
+ ],
338
+ )
342
339
 
340
+ self._assert_result(
341
+ select(
342
+ self.tables.data,
343
+ self.tables.data.c.val.func("$listsame", [1.0] * 50).label("same"),
344
+ ).limit(1),
345
+ [
346
+ ([1.0] * 50, 1),
347
+ ],
348
+ )
343
349
 
344
- class IRISVectorTest(fixtures.TablesTest):
345
- __backend__ = True
350
+ class IRISVectorTest(fixtures.TablesTest):
351
+ __backend__ = True
346
352
 
347
- __requires__ = ("iris_vector",)
353
+ __requires__ = ("iris_vector",)
348
354
 
349
- @classmethod
350
- def define_tables(cls, metadata):
351
- Table(
352
- "data",
353
- metadata,
354
- Column("id", INTEGER),
355
- Column("emb", IRISVector(3, float)),
356
- )
355
+ @classmethod
356
+ def define_tables(cls, metadata):
357
+ Table(
358
+ "data",
359
+ metadata,
360
+ Column("id", INTEGER),
361
+ Column("emb", IRISVector(3, float)),
362
+ )
357
363
 
358
- @classmethod
359
- def fixtures(cls):
360
- return dict(
361
- data=(
362
- (
363
- "id",
364
- "emb",
365
- ),
366
- (
367
- 1,
368
- [1, 1, 1],
369
- ),
370
- (
371
- 2,
372
- [2, 2, 2],
373
- ),
374
- (
375
- 3,
376
- [1, 1, 2],
377
- ),
364
+ @classmethod
365
+ def fixtures(cls):
366
+ return dict(
367
+ data=(
368
+ (
369
+ "id",
370
+ "emb",
371
+ ),
372
+ (
373
+ 1,
374
+ [1, 1, 1],
375
+ ),
376
+ (
377
+ 2,
378
+ [2, 2, 2],
379
+ ),
380
+ (
381
+ 3,
382
+ [1, 1, 2],
383
+ ),
384
+ )
378
385
  )
379
- )
380
386
 
381
- def _assert_result(self, select, result):
382
- with config.db.connect() as conn:
383
- eq_(conn.execute(select).fetchall(), result)
387
+ def _assert_result(self, select, result):
388
+ with config.db.connect() as conn:
389
+ eq_(conn.execute(select).fetchall(), result)
384
390
 
385
- def test_vector(self):
386
- self._assert_result(
387
- select(self.tables.data.c.emb),
388
- [
389
- ([1, 1, 1],),
390
- ([2, 2, 2],),
391
- ([1, 1, 2],),
392
- ],
393
- )
394
- self._assert_result(
395
- select(self.tables.data.c.id).where(self.tables.data.c.emb == [2, 2, 2]),
396
- [
397
- (2,),
398
- ],
399
- )
391
+ def test_vector(self):
392
+ self._assert_result(
393
+ select(self.tables.data.c.emb),
394
+ [
395
+ ([1, 1, 1],),
396
+ ([2, 2, 2],),
397
+ ([1, 1, 2],),
398
+ ],
399
+ )
400
+ self._assert_result(
401
+ select(self.tables.data.c.id).where(
402
+ self.tables.data.c.emb == [2, 2, 2]
403
+ ),
404
+ [
405
+ (2,),
406
+ ],
407
+ )
400
408
 
401
- def test_cosine(self):
402
- self._assert_result(
403
- select(
404
- self.tables.data.c.id,
405
- ).order_by(self.tables.data.c.emb.cosine([1, 1, 1])),
406
- [
407
- (1,),
408
- (2,),
409
- (3,),
410
- ],
411
- )
409
+ def test_cosine(self):
410
+ self._assert_result(
411
+ select(
412
+ self.tables.data.c.id,
413
+ ).order_by(self.tables.data.c.emb.cosine([1, 1, 1])),
414
+ [
415
+ (1,),
416
+ (2,),
417
+ (3,),
418
+ ],
419
+ )
412
420
 
413
- def test_cosine_distance(self):
414
- self._assert_result(
415
- select(
416
- self.tables.data.c.id,
417
- ).order_by(1 - self.tables.data.c.emb.cosine_distance([1, 1, 1])),
418
- [
419
- (1,),
420
- (2,),
421
- (3,),
422
- ],
423
- )
421
+ def test_cosine_distance(self):
422
+ self._assert_result(
423
+ select(
424
+ self.tables.data.c.id,
425
+ ).order_by(1 - self.tables.data.c.emb.cosine_distance([1, 1, 1])),
426
+ [
427
+ (1,),
428
+ (2,),
429
+ (3,),
430
+ ],
431
+ )
424
432
 
425
- def test_max_inner_product(self):
426
- self._assert_result(
427
- select(
428
- self.tables.data.c.id,
429
- ).order_by(self.tables.data.c.emb.max_inner_product([1, 1, 1])),
430
- [
431
- (1,),
432
- (3,),
433
- (2,),
434
- ],
435
- )
433
+ def test_max_inner_product(self):
434
+ self._assert_result(
435
+ select(
436
+ self.tables.data.c.id,
437
+ ).order_by(self.tables.data.c.emb.max_inner_product([1, 1, 1])),
438
+ [
439
+ (1,),
440
+ (3,),
441
+ (2,),
442
+ ],
443
+ )