Package¶
- pgconnection.configure(databases)[source]¶
Given a database configuration dictionary, return a copy that is configured to use the pgconnection database cursor.
- pgconnection.connect_pre_execute_hook(hook_func, using='default')[source]¶
Connects a hook function that will be executed before any SQL
- Parameters
hook_func (func) – The hook function that takes the SQL, its variables, and the cursor as arguments. It must return a tuple of the modified SQL and vars or None.
using (str, default='default') – The alias of the database. Must be present in settings.DATABASES
- pgconnection.disconnect_pre_execute_hook(hook_func, using='default')[source]¶
Disconnects a hook function that will be executed before any SQL
- Parameters
hook_func (func) – The hook function that takes the SQL, its variables, and the cursor as arguments. It must return a tuple of the modified SQL and vars.
using (str, default='default') – The alias of the database. Must be present in settings.DATABASES
- pgconnection.pre_execute_hook(hook_func, using='default')[source]¶
A context manager to run code with a connected pre_execute hook. See connect_pre_execute_hook for more information about the arguments.