Parquet to PostgreSQL

db2pq now exposes a first-class Parquet-to-PostgreSQL path.

Main helpers

  • pq_to_pg(table_name, schema, ...) writes a Parquet file from the local repository into PostgreSQL.
  • pq_update_pg(table_name, schema, ...) writes only when the Parquet source is newer than the destination PostgreSQL table.

Typical example

from db2pq import pq_update_pg

pq_update_pg(
    table_name="company",
    schema="comp",
    dbname="research",
)

How the update check works

pq_update_pg() reads the Parquet file’s embedded last_modified metadata and compares it with the destination PostgreSQL table comment.

If the Parquet file does not have parseable last_modified metadata, the function will ask you to use force=True instead of guessing.

Supporting helpers

  • pq_list_files() lists available Parquet outputs by schema.
  • pq_last_modified() inspects the embedded Parquet modification metadata.
  • pq_archive(), pq_restore(), and pq_remove() manage active and archived Parquet files in the local repository.