Skip to content

Add PostgreSQL bulk load via COPY FROM STDIN#65

Merged
martinv13 merged 1 commit into
cre-dev:mainfrom
martinv13:claude/postgres-bulk-load-dpu8v3
Jun 19, 2026
Merged

Add PostgreSQL bulk load via COPY FROM STDIN#65
martinv13 merged 1 commit into
cre-dev:mainfrom
martinv13:claude/postgres-bulk-load-dpu8v3

Conversation

@martinv13

Copy link
Copy Markdown
Collaborator

Summary

  • Overrides bulk_insert() in PostgreSQLDialect to stream an in-memory CSV payload to PostgreSQL using the native COPY FROM STDIN protocol instead of SQLAlchemy executemany
  • Supports both psycopg2 (cursor.copy_expert) and psycopg3 (cursor.copy), with automatic fallback to executemany for other drivers
  • Updates the PostgreSQL CI workflow to a matrix strategy that runs the full test suite against both drivers

Test plan

  • tests/test_bulk_insert_postgres.py — 7 test cases × 2 drivers (14 total): basic types, empty batch, numerics, boolean, datetime, bytea, scalar column defaults
  • CI matrix runs two jobs: one with psycopg2, one with psycopg[binary]
  • All non-DB tests continue to pass (pytest -m "not dbtest")
  • New tests skip cleanly when no PostgreSQL DB_STRING is configured

🤖 Generated with Claude Code

Overrides bulk_insert() in PostgreSQLDialect to stream an in-memory CSV
payload to PostgreSQL using the native COPY protocol instead of SQLAlchemy
executemany. Supports both psycopg2 (copy_expert) and psycopg3 (cursor.copy),
falling back to the base-class implementation for other drivers.

Adds integration tests parametrised over both drivers, and updates the
PostgreSQL CI workflow to a matrix that runs once per driver.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QvgSwLLGgKaDbZaEYYp7BJ
@martinv13 martinv13 merged commit 24e624f into cre-dev:main Jun 19, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants