# MySQL Tasks
This module contains a collection of tasks for interacting with MySQL databases via the pymysql library.
# MySQLExecute
class
prefect.tasks.mysql.mysql.MySQLExecute
(db_name=None, user=None, password=None, host=None, port=3306, query=None, commit=False, charset="utf8mb4", ssl=None, **kwargs)[source]Task for executing a query against a MySQL database.
Args:
db_name (str)
: name of MySQL databaseuser (str)
: user name used to authenticatepassword (str)
: password used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to MySQL database, defaults to 3307 if not providedquery (str, optional)
: query to execute against databasecommit (bool, optional)
: set to True to commit transaction, defaults to falsecharset (str, optional)
: charset you want to use (defaults to utf8mb4)ssl (dict, optional)
: A dict of arguments similar to mysql_ssl_set()’s parameters used for establishing encrypted connections using SSL**kwargs (Any, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.mysql.mysql.MySQLExecute.run (db_name=None, user=None, password=None, host=None, port=None, query=None, commit=None, charset=None, ssl=None)[source] |
Task run method. Executes a query against MySQL database.
|
# MySQLFetch
class
prefect.tasks.mysql.mysql.MySQLFetch
(db_name=None, user=None, password=None, host=None, port=3306, fetch="one", fetch_count=10, query=None, commit=False, charset="utf8mb4", cursor_type="cursor", ssl=None, **kwargs)[source]Task for fetching results of query from MySQL database.
Args:
db_name (str)
: name of MySQL databaseuser (str)
: user name used to authenticatepassword (str)
: password used to authenticatehost (str)
: database host addressport (int, optional)
: port used to connect to MySQL database, defaults to 3307 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 databasecommit (bool, optional)
: set to True to commit transaction, defaults to falsecharset (str, optional)
: charset of the query, defaults to "utf8mb4"cursor_type (Union[str, Callable], optional)
: The cursor type to use. Can be'cursor'
(the default),'dictcursor'
,'sscursor'
,'ssdictcursor'
, or a full cursor class.ssl (dict, optional)
: A dict of arguments similar to mysql_ssl_set()’s parameters used for establishing encrypted connections using SSL. To connect with SSL, at leastssl_ca
,ssl_cert
, andssl_key
must be specified.**kwargs (Any, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.mysql.mysql.MySQLFetch.run (db_name=None, user=None, password=None, host=None, port=None, fetch=None, fetch_count=None, query=None, commit=None, charset=None, cursor_type=None, ssl=None)[source] |
Task run method. Executes a query against MySQL database and fetches results.
|
This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC