# 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="", user="", password="", 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)
  • user (str, optional, DEPRECATED): user name used to authenticate. Deprecated, should be passed at runtime instead.
  • password (str, optional, DEPRECATED): password used to authenticate. Deprecated, should be passed at runtime instead.
  • 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): user name used to authenticate
  • password (str): password used to authenticate; should be provided from a Secret task
  • dsn (str, optional): dsn string of the database (server:port)
  • 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="", user="", password="", 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)
  • user (str, optional, DEPRECATED): user name used to authenticate. Deprecated, should be passed at runtime instead.
  • password (str, optional, DEPRECATED): password used to authenticate. Deprecated, should be passed at runtime instead.
  • 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): user name used to authenticate
  • password (str): password used to authenticate; should be provided from a Secret task
  • dsn (str, optional): dsn string of the database (server:port)
  • 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:
  • ExaStatement object
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="", user="", password="", 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)
  • user (str, optional, DEPRECATED): user name used to authenticate. Deprecated, should be passed at runtime instead.
  • password (str, optional, DEPRECATED): password used to authenticate. Deprecated, should be passed at runtime instead.
  • 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): user name used to authenticate
  • password (str): password used to authenticate; should be provided from a Secret task
  • dsn (str, optional): dsn string of the database (server:port)
  • 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="", user="", password="", 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)
  • user (str, optional, DEPRECATED): user name used to authenticate. Deprecated, should be passed at runtime instead.
  • password (str, optional, DEPRECATED): password used to authenticate. Deprecated, should be passed at runtime instead.
  • 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): user name used to authenticate
  • password (str): password used to authenticate; should be provided from a Secret task
  • dsn (str, optional): dsn string of the database (server:port)
  • 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 59ae220
on April 9, 2021 at 15:46 UTC