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