internalsGet Pro

Module 03 · Lesson 5 of 10Pro

Reading and writing databases from Python

Level
Intermediate
Topic
Python for data engineering
Reading time
16 min

When you finish this page you can

  1. Explain where a query’s rows sit in memory with a client-side cursor, a server-side cursor and keyset chunks.
  2. Explain why a long read on a PostgreSQL read replica loses its connection, and choose between the ways to prevent it.
  3. Copy a night of rows from PostgreSQL into DuckDB in short keyset chunks, with parameters, a staging table and one transaction.
  4. Pick a fast way to write many rows into DuckDB or PostgreSQL instead of one INSERT per row.
  1. Design: a first analytics pipeline for an online store30 min
  2. The Python data toolkit: libraries that matter12 min

Ten million rows in one call

It’s 01:05 on Tuesday, 10 November, at . Kartly is an online store in India. Every night a job copies the day’s orders and click events from the store’s PostgreSQL into , where Daniel, who leads finance reporting, reads them at 07:00.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan