ds_provider_postgresql_py_lib.utils.dataset_rows¶
File: dataset_rows.py
Region: ds_provider_postgresql_py_lib/utils/dataset_rows
Dataset Row Helpers
This module contains row execution and dataframe materialization helpers.
Functions¶
|
Execute a statement with RETURNING and convert rows to dicts. |
|
Build output DataFrame using a stable table-column order. |
Module Contents¶
- ds_provider_postgresql_py_lib.utils.dataset_rows.execute_returning_rows(conn: sqlalchemy.engine.Connection, stmt: sqlalchemy.sql.Executable) list[dict[str, Any]][source]¶
Execute a statement with RETURNING and convert rows to dicts.
- Parameters:
conn – SQLAlchemy connection.
stmt – SQL statement to execute.
- Returns:
Returned rows as dictionaries.
- Return type:
list[dict[str, Any]]
- ds_provider_postgresql_py_lib.utils.dataset_rows.output_from_rows(table: sqlalchemy.Table, rows: list[dict[str, Any]]) pandas.DataFrame[source]¶
Build output DataFrame using a stable table-column order.
- Parameters:
table – Reflected SQLAlchemy table.
rows – Row dictionaries to materialize.
- Returns:
Output DataFrame aligned to table column order.
- Return type:
pd.DataFrame