# SQL Server Tasks
This module contains a collection of tasks for interacting with SQL Server databases via the pyodbc library.
# SqlServerExecute
class
prefect.tasks.sql_server.sql_server.SqlServerExecute
(db_name, user, host, port=1433, driver="ODBC Driver 17 for SQL Server", query=None, data=None, commit=False, **kwargs)[source]Task for executing a query against a SQL Server database.
Args:
db_name (str)
: name of SQL Server databaseuser (str)
: user name used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to SQL Server database, defaults to 1433 if not provideddriver (str, optional)
: driver used to communicate with SQL Server databasequery (str, optional)
: query to execute against databasedata (tuple, optional)
: values to use in query, must be specified using placeholder in 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.sql_server.sql_server.SqlServerExecute.run (query=None, data=None, commit=False, password=None)[source] |
Task run method. Executes a query against SQL Server database.
|
# SqlServerExecuteMany
class
prefect.tasks.sql_server.sql_server.SqlServerExecuteMany
(db_name, user, host, port=1433, driver="ODBC Driver 17 for SQL Server", query=None, data=None, commit=False, **kwargs)[source]Task for executing many queries against a SQL Server database.
Args:
db_name (str)
: name of SQL Server databaseuser (str)
: user name used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to SQL Server database, defaults to 1433 if not provideddriver (str, optional)
: driver used to communicate with SQL Server databasequery (str, optional)
: query to execute against databasedata (tuple, optional)
: values to use in query, must be specified using placeholder in 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.sql_server.sql_server.SqlServerExecuteMany.run (query=None, data=None, commit=False, password=None, fast_executemany=False)[source] |
Task run method. Executes many queries against SQL Server database.
|
# SqlServerFetch
class
prefect.tasks.sql_server.sql_server.SqlServerFetch
(db_name, user, host, port=1433, driver="ODBC Driver 17 for SQL Server", fetch="one", fetch_count=10, query=None, data=None, commit=False, **kwargs)[source]Task for fetching results of query from SQL Server database.
Args:
db_name (str)
: name of SQL Server databaseuser (str)
: user name used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to SQL Server database, defaults to 5432 if not provideddriver (str, optional)
: driver used to communicate with SQL Server databasefetch (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 in 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.sql_server.sql_server.SqlServerFetch.run (fetch="one", fetch_count=10, query=None, data=None, commit=False, password=None)[source] |
Task run method. Executes a query against SQL Server database and fetches results.
|
This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC