firebolt.async_db package
firebolt.async_db.connection module
- class firebolt.async_db.connection.Connection(engine_url: str, database: str, username: str, password: str, api_endpoint: str = 'api.app.firebolt.io')
Bases:
firebolt.async_db.connection.BaseConnection
Firebolt asyncronous database connection class. Implements PEP 249.
- Parameters
engine_url – Firebolt database engine REST API url
database – Firebolt database name
username – Firebolt account username
password – Firebolt account password
api_endpoint – Optional. Firebolt API endpoint. Used for authentication.
Note
Firebolt currenly doesn’t support transactions so commit and rollback methods are not implemented.
- async aclose() None
Close connection and all underlying cursors.
- api_endpoint
- client_class: type
- cursor() firebolt.async_db.cursor.Cursor
- cursor_class
alias of
firebolt.async_db.cursor.Cursor
- database
- engine_url
- class firebolt.async_db.connection.OverriddenHttpBackend
Bases:
httpcore.backends.auto.AutoBackend
This class is a short-term solution for TCP keep-alive issue: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#connection-idle-timeout Since httpx creates a connection right before executing a request backend has to be overridden in order to set the socket KEEPALIVE and KEEPIDLE settings.
- async connect_tcp(host: str, port: int, timeout: Optional[float] = None, local_address: Optional[str] = None) httpcore.backends.base.AsyncNetworkStream
- firebolt.async_db.connection.async_connect_factory(connection_class: Type) Callable
- async firebolt.async_db.connection.connect(database: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, engine_name: Optional[str] = None, engine_url: Optional[str] = None, account_name: Optional[str] = None, api_endpoint: str = 'api.app.firebolt.io') firebolt.async_db.connection.Connection
Connect to Firebolt database.
- Parameters
database – name of the database to connect
username – user name to use for authentication
password – password to use for authentication
engine_name – Optional The name of the engine to connect to
engine_url – Optional. The engine endpoint to use
account_name – For customers with multiple accounts; if None uses default.
api_endpoint (optional) – Firebolt API endpoint. Used for authentication.
Note
Either engine_name or engine_url should be provided, but not both.
firebolt.async_db.cursor module
- class firebolt.async_db.cursor.Cursor(*args: Any, **kwargs: Any)
Bases:
firebolt.async_db.cursor.BaseCursor
Class, responsible for executing asyncio queries to Firebolt Database. Should not be created directly, use
connection.cursor
- Parameters
description – information about a single result row
rowcount – the number of rows produced by last query
closed – True if connection is closed, False otherwise
arraysize – Read/Write, specifies the number of rows to fetch at a time with the
fetchmany()
method
- connection
- async execute(query: str, parameters: Optional[Sequence[Union[int, float, str, datetime.datetime, datetime.date, bool, Sequence]]] = None, set_parameters: Optional[Dict] = None) int
Prepare and execute a database query. Return row count.
- async executemany(query: str, parameters_seq: Sequence[Sequence[Union[int, float, str, datetime.datetime, datetime.date, bool, Sequence]]]) int
Prepare and execute a database query against all parameter sequences provided. Return last query row count.
- async fetchall() List[List[Optional[Union[int, float, str, datetime.datetime, datetime.date, bool, list]]]]
Fetch all remaining rows of a query result.
- async fetchmany(size: Optional[int] = None) List[List[Optional[Union[int, float, str, datetime.datetime, datetime.date, bool, list]]]]
Fetch the next set of rows of a query result, cursor.arraysize is default size.
- async fetchone() Optional[List[Optional[Union[int, float, str, datetime.datetime, datetime.date, bool, list]]]]
Fetch the next row of a query result set.
- async nextset() Optional[bool]
Skip to the next available set, discarding any remaining rows from the current set. Returns True if operation was successful, None if there are no more sets to retrive
- class firebolt.async_db.cursor.CursorState(value)
Bases:
enum.Enum
An enumeration.
- CLOSED = 4
- DONE = 3
- ERROR = 2
- NONE = 1
- firebolt.async_db.cursor.check_not_closed(func: Callable) Callable
(Decorator) ensure cursor is not closed before calling method.
- firebolt.async_db.cursor.check_query_executed(func: Callable) Callable
Module contents
- firebolt.async_db.TimestampFromTicks()
timestamp[, tz] -> tz’s local time from POSIX timestamp.