MagicStack / MagicStack/asyncpg

Does COPY FROM gaurentee no partial rows?

Open
#344 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

A quick question, since this is not very obvious from the postgres or asyncpg docs: under what circumstances, if any, does `copy_from_query` guarantee that no partial rows will be delivered to the `output` coroutine?

In my experience this hasn't happened, and I could try some more exhaustive testing, but I imagine/hope that someone might just already know the answer.

To me the options seem to be:
- If the networking code reads one line at a time, then the 'text' format guarantees full rows, but not necessarily 'csv' or 'binary'
- Asyncpg itself or postgres itself may explicitly implement such a guarantee?
- Otherwise, there is no guarantee.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PostgreSQL and asyncpg documentation for copy_from_query, then trace how its output coroutine is described in the available asyncpg material. Document the circumstances, if any, under which text, CSV, and binary output avoid partial rows, and make the guarantee clear to users.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.