atoti_directquery_redshift.RedshiftConnectionInfo#

class atoti_directquery_redshift.RedshiftConnectionInfo#

Information needed to connect to a Redshift database.

__init__(url, /, *, auto_multi_column_array_conversion=None, lookup_mode='warn', max_sub_queries=500, password=None, query_timeout=datetime.timedelta(seconds=3600))#

Create a Redshift connection info.

Parameters:
  • url (str) – The JDBC connection string.

  • auto_multi_column_array_conversion (AutoMultiColumnArrayConversion | None) – When not None, multi column array conversion will be performed automatically.

  • lookup_mode (Literal['allow', 'warn', 'deny']) – Whether lookup queries on the external database are allowed. Lookup can be very slow and expensive as the database may not enforce primary keys.

  • max_sub_queries (int) – Maximum number of subqueries performed when splitting a query into multi-steps queries.

  • password (str | None) –

    The password to connect to the database.

    Passing it in this separate parameter allows to avoid having it logged alongside the connection string.

    If None, a password is expected to be present in the passed url.

  • query_timeout (timedelta) – Timeout for queries performed on the external database.

Example

>>> import os
>>> from atoti_directquery_redshift import RedshiftConnectionInfo
>>> connection_info = RedshiftConnectionInfo(
...     "jdbc:redshift://"
...     + os.environ["REDSHIFT_ACCOUNT_IDENTIFIER"]
...     + ".redshift.amazonaws.com:5439/dev?user="
...     + os.environ["REDSHIFT_USERNAME"]
...     + "&schema=test_resources",
...     password=os.environ["REDSHIFT_PASSWORD"],
... )
>>> external_database = session.connect_to_external_database(
...     connection_info
... )