Skip to content

Handle tz argument in wrds_update_pg/wrds_update_pq interfaces #9

Description

@iangow

Problem

Some downstream scripts still pass a tz keyword argument (e.g., tz="America/New_York") to wrapper functions. db2pq.postgres.update.wrds_update_pg() currently does not accept tz, which causes breakage when callers migrate from older wrappers that tolerated it.

Existing reference behavior (wrds2pg)

In wrds2pg, wrds_update() explicitly accepts tz (default "UTC") and applies it during ingest by setting PostgreSQL session timezone before COPY (SET TimeZone TO '<tz>').

Desired behavior

db2pq should handle tz arguments consistently so downstream update scripts do not need compatibility shims.

Proposed options

  1. Add optional tz=None parameter to wrds_update_pg() and wrds_update_pq() and document whether it is currently ignored or applied.
  2. If unsupported by design, fail with a clear, actionable error message instead of a generic unexpected keyword error.

Acceptance criteria

  • Passing tz does not crash with TypeError: unexpected keyword argument 'tz'.
  • Behavior is documented in README/API docs.
  • If supported, behavior aligns with the wrds2pg::wrds_update() model (default UTC, explicit timezone handling semantics).
  • Tests cover calls with and without tz.

Context

This surfaced while simplifying wrds_pg/audit scripts to use upstream regex-based keep/drop handling directly from db2pq.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions