pgcom.base.BaseCommuter.execute¶
- BaseCommuter.execute(cmd: Union[str, psycopg2.sql.Composed], values: Optional[Union[Sequence[Any], Mapping[str, Any]]] = None) None [source]¶
Execute a database operation (query or command).
- Parameters
cmd – SQL query to be executed.
values – Query parameters.
- Returns
List of rows of a query result and list of column names. Two empty lists are returned if there is no records to fetch.
- Raises
QueryExecutionError – if execution fails.