Skip to content

Inserting iterables of Python objects into PostgreSQL - COPY? #2897

Answered by WillAyd
michalc asked this question in Q&A
Discussion options

You must be logged in to vote

Generally I think its best to wrap the iterable(s) in an arrow structure. It doesn't necessarily need to be a Table; RecordBatch and RecordBatchReader objects work just as well (really anything that implements the Arrow PyCapsule Interface)

Behind the scenes the ADBC postgres driver issues a COPY command anyway, but if you route it through an Arrow structure it can communicate with the database using the binary format, whereas I (perhaps mistakenly) assume a manual COPY from stdin is going to use the text-based protocol

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@michalc
Comment options

Answer selected by michalc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants