(value)
| 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 |
no test coverage detected