postgres.update.wrds_update_pg
postgres.update.wrds_update_pg(
table_name,
schema,
*,
wrds_id=None,
col_types=None,
sas_schema=None,
obs=None,
alt_table_name=None,
keep=None,
drop=None,
rename=None,
user=None,
host=None,
dbname=None,
port=None,
force=False,
create_roles=True,
wrds_schema=None,
use_sas=False,
encoding='utf-8',
tz='UTC',
)Materialize a WRDS PostgreSQL table into a local PostgreSQL database.
The destination table is created from scratch based on the SQL SELECT used to extract the data (via DuckDB schema inference), then populated using PostgreSQL binary COPY for performance.
Notes
- Any existing destination table is dropped.
keep/dropuse regex matching on source column names.- If both
dropandkeepare provided,dropis applied first. renamemaps source column names to output column names.col_typesrefers to the output names after renaming.- Update / fingerprint logic is handled elsewhere (or added later).
- If
create_rolesis True, ensures schema owner role (<schema>) and read-only role (<schema>_access) exist, then applies grants. - If
wrds_schemais provided, it is used as the source WRDS schema while data are still written to destinationschema. - If
use_sasis True, freshness and destination comment metadata are derived from SAS metadata instead of WRDS PostgreSQL comments. sas_schemaoverrides the SAS-side schema used for metadata lookups whenuse_sasis True.tz(default"UTC") is used to convert sourcetimestamp without time zonecolumns viaAT TIME ZONE.
Returns
| Name | Type | Description |
|---|---|---|
| bool | True if an update was performed, False if the destination table was already up to date. |