MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / process

Method process

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

Source from the content-addressed store, hash-verified

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

Callers 14

visit_mod_binaryMethod · 0.45
visit_match_op_binaryMethod · 0.45
visit_joinMethod · 0.45
returning_clauseMethod · 0.45
for_update_clauseMethod · 0.45
_visit_bitwiseMethod · 0.45

Calls 3

_array_typecodeMethod · 0.95
SparseVectorClass · 0.85
arrayMethod · 0.80

Tested by

no test coverage detected