apache / apache/arrow-adbc

c/driver/postgresql: consider VECTOR type support

Open
#2,902 1 comment 0 reactions 0 assignees View on GitHub
Type: enhancement
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

### Discussed in https://github.com/apache/arrow-adbc/discussions/2900

Originally posted by **michalc** May 31, 2025
I'm looking to insert data into a VECTOR column by using `adbc_get_table_schema` to determine the schema of a table, but I'm having some problems getting beyond creating a RecordBatch (which I then would use in a RecordBatchReader and adbc_ingest)

Specifically, running:

```python
import adbc_driver_postgresql.dbapi
import pyarrow as pa

with adbc_driver_postgresql.dbapi.connect("postgresql://postgres:password@127.0.0.1:5432/") as conn:
with conn.cursor() as cursor:
cursor.execute('CREATE TABLE my_table (my_vector VECTOR)')
schema = conn.adbc_get_table_schema("my_table")
pa.RecordBatch.from_pylist([
{
'my_vector': [1, 2]
}
], schema=schema)
```
Results in an error:
```
Traceback (most recent call last):
File "[...]", line 8, in
pa.RecordBatch.from_pylist([
File "pyarrow/table.pxi", line 2046, in pyarrow.lib._Tabular.from_pylist
File "pyarrow/table.pxi", line 6438, in pyarrow.lib._from_pylist
File "pyarrow/table.pxi", line 3546, in pyarrow.lib.RecordBatch.from_arrays
File "pyarrow/table.pxi", line 1622, in pyarrow.lib._sanitize_arrays
File "pyarrow/array.pxi", line 405, in pyarrow.lib.asarray
File "pyarrow/array.pxi", line 375, in pyarrow.lib.array
File "pyarrow/array.pxi", line 45, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Expected bytes, got a 'list' object
```

It seems to only want `bytes` as the vector data, but I'm not sure how to encode a list as bytes. How can I create the RecordBatch, or otherwise insert data into a VECTOR column?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.