# Postgres Tasks
This module contains a collection of tasks for interacting with Postgres databases via the psycopg2 library.
# PostgresExecute
class
prefect.tasks.postgres.postgres.PostgresExecute
(db_name, user, host, port=5432, query=None, data=None, commit=False, **kwargs)[source]Task for executing a query against a Postgres database.
Args:
db_name (str)
: name of Postgres databaseuser (str)
: user name used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to Postgres database, defaults to 5432 if not providedquery (str, optional)
: query to execute against databasedata (tuple, optional)
: values to use in query, must be specified using placeholder is query stringcommit (bool, optional)
: set to True to commit transaction, defaults to false**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.postgres.postgres.PostgresExecute.run (query=None, data=None, commit=False, password=None)[source] |
Task run method. Executes a query against Postgres database.
|
# PostgresExecuteMany
class
prefect.tasks.postgres.postgres.PostgresExecuteMany
(db_name, user, host, port=5432, query=None, data=None, commit=False, **kwargs)[source]Task for executing many queries against a Postgres database.
Args:
db_name (str)
: name of Postgres databaseuser (str)
: user name used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to Postgres database, defaults to 5432 if not providedquery (str, optional)
: query to execute against database is query stringdata (List[tuple], optional)
: list of values to use in query, must be specified using placeholdercommit (bool, optional)
: set to True to commit transaction, defaults to false**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.postgres.postgres.PostgresExecuteMany.run (query=None, data=None, commit=False, password=None)[source] |
Task run method. Executes many queries against Postgres database.
|
# PostgresFetch
class
prefect.tasks.postgres.postgres.PostgresFetch
(db_name, user, host, port=5432, fetch="one", fetch_count=10, query=None, data=None, commit=False, **kwargs)[source]Task for fetching results of query from Postgres database.
Args:
db_name (str)
: name of Postgres databaseuser (str)
: user name used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to Postgres database, defaults to 5432 if not providedfetch (str, optional)
: one of "one" "many" or "all", used to determine how many results to fetch from executed queryfetch_count (int, optional)
: if fetch = 'many', determines the number of results to fetch, defaults to 10query (str, optional)
: query to execute against databasedata (tuple, optional)
: values to use in query, must be specified using placeholder is query stringcommit (bool, optional)
: set to True to commit transaction, defaults to false**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.postgres.postgres.PostgresFetch.run (fetch="one", fetch_count=10, query=None, data=None, commit=False, password=None, col_names=False)[source] |
Task run method. Executes a query against Postgres database and fetches results.
|
This documentation was auto-generated from commit n/a
on July 1, 2021 at 18:35 UTC