Skip to content

Formatting rows for copy_to_table? #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robhaswell opened this issue Mar 8, 2021 · 2 comments
Closed

Formatting rows for copy_to_table? #712

robhaswell opened this issue Mar 8, 2021 · 2 comments

Comments

@robhaswell
Copy link

robhaswell commented Mar 8, 2021

  • asyncpg version: 0.22.0

Does asyncpg contain any code that would format tuples suitable for consumption in copy_to_table? I can see that copy_records_to_table should somehow format the tuples into the COPY FROM format but I can't see where this happens.

My use-case is that I am trying to use COPY FROM with an async iterator.

Thanks.

@elprans
Copy link
Member

elprans commented Mar 8, 2021

Does asyncpg contain any code that would format tuples suitable for consumption in copy_to_table?

Yes. The magic happens in copy_in in protocol.pyx, and copy_records_to_table exists exactly for this purpose. Adding support for async iterables there shouldn't be hard.

@elprans
Copy link
Member

elprans commented Mar 8, 2021

See #689.

@elprans elprans closed this as completed Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants