# Exasol Tasks


This module contains a collection of tasks for interacting with Exasol databases via the pyexasol library.

# ExasolFetch

class

prefect.tasks.exasol.exasol.ExasolFetch

(dsn="", dsn_secret="", user_secret="", password_secret="", fetch="one", fetch_size=10, query=None, query_params=None, **kwargs)[source]

Task for fetching results of query from Exasol database.

Args:

  • dsn (str, optional): dsn string of the database (server:port)
  • dsn_secret (str, optional): the name of the Prefect Secret that stores the Exasol dsn connection string (server:port)
  • user_secret (str, optional): the name of the Prefect Secret that stores the Exasol user name
  • password_secret (str, optional): the name of the Prefect Secret that stores the Exasol password
  • fetch (str, optional): one of "one" "many" "val" or "all", used to determine how many results to fetch from executed query
  • fetch_size (int, optional): if fetch = 'many', determines the number of results to fetch, defaults to 10
  • query (str, optional): query to execute against database
  • query_params (dict, optional): Values for SQL query placeholders
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.exasol.exasol.ExasolFetch.run

(user="", password="", dsn="", fetch="one", fetch_size=10, query=None, query_params=None, **kwargs)[source]

Task run method. Executes a query against Exasol database and fetches results.

Args:

  • user (str, optional): user name used to authenticate. This overrides the initial user_secret parameter (if set)
  • password (str, optional): password used to authenticate. This overrides the initial user_secret parameter (if set)
  • dsn (str, optional): dsn string of the database (server:port) This overrides the initial user_secret parameter (if set)
  • fetch (str, optional): one of "one" "many" "val" or "all", used to determine how many results to fetch from executed query
  • fetch_size (int, optional): if fetch = 'many', determines the number of results to fetch, defaults to 10
  • query (str, optional): query to execute against database
  • query_params (dict, optional): Values for SQL query placeholders
  • **kwargs (dict, optional): additional connection parameter (autocommit, connection_timeout...)
Returns:
  • records (None, str, tuple, list of tuples, dict, or list of dicts): records from provided query
Raises:
  • ValueError: if dsn string is not provided
  • ValueError: if query parameter is None or a blank string
  • Exa*Error: multiple exceptions raised from the underlying pyexasol package (e.g. ExaQueryError, ExaAuthError..)



# ExasolExecute

class

prefect.tasks.exasol.exasol.ExasolExecute

(dsn="", dsn_secret="", user_secret="", password_secret="", query=None, query_params=None, autocommit=False, commit=True, **kwargs)[source]

Task for executing a query against a Exasol database.

Args:

  • dsn (str, optional): dsn string of the database (server:port)
  • dsn_secret (str, optional): the name of the Prefect Secret that stores the Exasol dsn connection string (server:port)
  • user_secret (str, optional): the name of the Prefect Secret that stores the Exasol user name
  • password_secret (str, optional): the name of the Prefect Secret that stores the Exasol password
  • query (str, optional): query to execute against database
  • query_params (dict, optional): Values for SQL query placeholders
  • autocommit (bool, optional): turn autocommit on or off (default: False)
  • commit (bool, optional): set to True to commit transaction, defaults to True (only necessary if autocommit = False)
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.exasol.exasol.ExasolExecute.run

(user="", password="", dsn="", query=None, query_params=None, autocommit=False, commit=True, **kwargs)[source]

Task run method. Executes a query against Exasol database.

Args:

  • user (str, optional): user name used to authenticate. This overrides the initial user_secret parameter (if set)
  • password (str, optional): password used to authenticate. This overrides the initial user_secret parameter (if set)
  • dsn (str, optional): dsn string of the database (server:port) This overrides the initial user_secret parameter (if set)
  • query (str, optional): query to execute against database
  • query_params (dict, optional): Values for SQL query placeholders
  • autocommit (bool, optional): turn autocommit on or off (default: False)
  • commit (bool, optional): set to True to commit transaction, defaults to True (only necessary if autocommit = False)
  • **kwargs (dict, optional): additional connection parameter (connection_timeout...)
Returns:
  • Nothing
Raises:
  • ValueError: if dsn string is not provided
  • ValueError: if query parameter is None or a blank string
  • Exa*Error: multiple exceptions raised from the underlying pyexasol package (e.g. ExaQueryError, ExaAuthError..)



# ExasolImportFromIterable

class

prefect.tasks.exasol.exasol.ExasolImportFromIterable

(dsn="", dsn_secret="", user_secret="", password_secret="", target_schema=None, target_table=None, data=None, import_params=None, autocommit=False, commit=True, **kwargs)[source]

Task for importing a iterable with data into the Exasol database.

Args:

  • dsn (str, optional): dsn string of the database (server:port)
  • dsn_secret (str, optional): the name of the Prefect Secret that stores the Exasol dsn connection string (server:port)
  • user_secret (str, optional): the name of the Prefect Secret that stores the Exasol user name
  • password_secret (str, optional): the name of the Prefect Secret that stores the Exasol password
  • target_schema (str, optional): target schema for importing data
  • target_table (str, optional): target table for importing data
  • data (Iterable, optional): an iterable which holds the import data
  • import_params (dict, optional): custom parameters for IMPORT query
  • autocommit (bool, optional): turn autocommit on or off (default: False)
  • commit (bool, optional): set to True to commit transaction, defaults to false (only necessary if autocommit = False)
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.exasol.exasol.ExasolImportFromIterable.run

(user="", password="", dsn="", target_schema=None, target_table=None, data=None, import_params=None, autocommit=False, commit=True, **kwargs)[source]

Task run method. Executes a query against Postgres database.

Args:

  • user (str, optional): user name used to authenticate. This overrides the initial user_secret parameter (if set)
  • password (str, optional): password used to authenticate. This overrides the initial user_secret parameter (if set)
  • dsn (str, optional): dsn string of the database (server:port) This overrides the initial user_secret parameter (if set)
  • target_schema (str, optional): target schema for importing data
  • target_table (str, optional): target table for importing data
  • data (Iterable, optional): an iterable which holds the import data
  • import_params (dict, optional): custom parameters for IMPORT query
  • autocommit (bool, optional): turn autocommit on or off (default: False)
  • commit (bool, optional): set to True to commit transaction, defaults to false (only necessary if autocommit = False)
  • **kwargs (dict, optional): additional connection parameter (connection_timeout...)
Returns:
  • Nothing
Raises:
  • ValueError: if dsn string is not provided
  • ValueError: if data is not provided or is empty
  • ValueError: if target_table is not provided
  • Exa*Error: multiple exceptions raised from the underlying pyexasol package (e.g. ExaQueryError, ExaAuthError..)



# ExasolExportToFile

class

prefect.tasks.exasol.exasol.ExasolExportToFile

(dsn="", dsn_secret="", user_secret="", password_secret="", destination=None, query_or_table=None, query_params=None, export_params=None, **kwargs)[source]

Task for exporting data of an Exasol database into a single csv.

Args:

  • dsn (str, optional): dsn string of the database (server:port)
  • dsn_secret (str, optional): the name of the Prefect Secret that stores the Exasol dsn connection string (server:port)
  • user_secret (str, optional): the name of the Prefect Secret that stores the Exasol user name
  • password_secret (str, optional): the name of the Prefect Secret that stores the Exasol password
  • destination ([str, Path], optional): Path to file or file-like object
  • query_or_table (str, optional): SQL query or table for export could be: 1. SELECT * FROM S.T 2. tablename 3. (schemaname, tablename)
  • query_params (dict, optional): Values for SQL query placeholders
  • export_params (dict, optional): custom parameters for EXPORT query
  • **kwargs (dict, optional): additional keyword arguments to pass to the Task constructor

methods:                                                                                                                                                       

prefect.tasks.exasol.exasol.ExasolExportToFile.run

(user="", password="", dsn="", destination=None, query_or_table=None, query_params=None, export_params=None, **kwargs)[source]

Task run method. Executes a query against Postgres database.

Args:

  • user (str, optional): user name used to authenticate. This overrides the initial user_secret parameter (if set)
  • password (str, optional): password used to authenticate. This overrides the initial user_secret parameter (if set)
  • dsn (str, optional): dsn string of the database (server:port) This overrides the initial user_secret parameter (if set)
  • destination ([str, Path], optional): Path to file or file-like object
  • query_or_table (str, optional): SQL query or table for export could be: 1. SELECT * FROM S.T 2. tablename 3. (schemaname, tablename)
  • query_params (dict, optional): Values for SQL query placeholders
  • export_params (dict, optional): custom parameters for EXPORT query
  • **kwargs (dict, optional): additional connection parameter (connection_timeout...)
Returns:
  • Nothing
Raises:
  • ValueError: if dsn string is not provided
  • ValueError: if destination is not provided
  • ValueError: if no query or table are provided
  • Exa*Error: multiple exceptions raised from the underlying pyexasol package (e.g. ExaQueryError, ExaAuthError..)



This documentation was auto-generated from commit ffa9a6c
on February 1, 2023 at 18:44 UTC