MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / process

Method process

lib/sqlalchemy/dialects/oracle/vector.py:300–322  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

298 """
299
300 def process(value):
301 if value is None or isinstance(value, array.array):
302 return value
303
304 # Convert list to a array.array
305 elif isinstance(value, list):
306 typecode = self._array_typecode(self.storage_format)
307 value = array.array(typecode, value)
308 return value
309
310 # Convert SqlAlchemy SparseVector to oracledb SparseVector object
311 elif isinstance(value, SparseVector):
312 return dialect.dbapi.SparseVector(
313 value.num_dimensions,
314 value.indices,
315 value.values,
316 )
317
318 else:
319 raise TypeError("""
320 Invalid input for VECTOR: expected a list, an array.array,
321 or a SparseVector object.
322 """)
323
324 return process
325

Callers 15

visit_mod_binaryMethod · 0.45
visit_match_op_binaryMethod · 0.45
visit_castMethod · 0.45
visit_joinMethod · 0.45
returning_clauseMethod · 0.45
for_update_clauseMethod · 0.45

Calls 3

_array_typecodeMethod · 0.95
SparseVectorClass · 0.85
arrayMethod · 0.80

Tested by

no test coverage detected