You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "lidavidm (via GitHub)" <gi...@apache.org> on 2025/06/01 10:06:43 UTC

[I] c/driver/postgresql: consider VECTOR type support [arrow-adbc]

lidavidm opened a new issue, #2902:
URL: https://github.com/apache/arrow-adbc/issues/2902

   
   ### Discussed in https://github.com/apache/arrow-adbc/discussions/2900
   
   <div type='discussions-op-text'>
   
   <sup>Originally posted by **michalc** May 31, 2025</sup>
   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 <module>
       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?</div>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] c/driver/postgresql: consider VECTOR type support [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on issue #2902:
URL: https://github.com/apache/arrow-adbc/issues/2902#issuecomment-2927637413

   The read side is probably not bad (https://github.com/apache/arrow-adbc/pull/2072 is a good template for the pieces that need to be updated to implement read support). I think our COPY writing wasn't built with many-to-many conversions in mind (which is what we need here) but it may work out of the box if Postgres implements implicit casting from an array to a vector.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org