Skip to Content
HeadGym PABLO
Developer GuideDatabase Integration

Install Database Drivers

StreamZero DX requires a Python DB-API database driver and a SQLAlchemy dialect to be installed for each datastore you want to connect to within the executor image.

Configuring Database Connections

StreamZero can manage preset connection configurations. This enables a platform wide set up for both confidential as well as general access databases.

StreamZero uses the SQL Alchemy Engine along with the URL template based approach to connection management. The connection configurations are maintained as secrets within the platform and are therefore not publicly accessible i.e. access is provided for administrators only.

Retrieving DB Connections

The following is how to retrieve a named connection. The following sample assumes that the connection identifier key is uploaded to the package as a secrets.json.

from fx_ef import context import sqlalchemy as db db_url = context.secrets.get('my_connection') engine = db.create_engine(db_url) connection = engine.connect() metadata = db.MetaData()

In the above example the db_url is set up as a secret with name 'my_connection'.

Depending on whether this is a service, project or platform level secret there are different approaches to set up the secret. For service level secret the following is a sample set up for a secrets.json file of the package.

{ "my_connection" = "mysql://scott:tiger@localhost/test" }
  • For Project scope use the 'secrets' tab of the Project Management UI.
  • For Platform scope secrets use the Vault UI in the DX Manager Application.

Database Drivers

The following table provides a guide on the python libs to be installed within the Executor docker image. For instructions on how to extend the Executor docker image please check this page: /docs/extending_executor_image

You can read more here about how to install new database drivers and libraries into your StreamZero DX executor image.

Note that many other databases are supported, the main criteria being the existence of a functional SQLAlchemy dialect and Python driver. Searching for the keyword “sqlalchemy + (database name)” should help get you to the right place.

If your database or data engine isn’t on the list but a SQL interface exists, please file an issue so we can work on documenting and supporting it.

A list of some of the recommended packages.

DatabasePyPI package
Amazon Athenapip install "PyAthenaJDBC>1.0.9 , pip install "PyAthena>1.2.0
Amazon Redshiftpip install sqlalchemy-redshift
Apache Drillpip install sqlalchemy-drill
Apache Druidpip install pydruid
Apache Hivepip install pyhive
Apache Impalapip install impyla
Apache Kylinpip install kylinpy
Apache Pinotpip install pinotdb
Apache Solrpip install sqlalchemy-solr
Apache Spark SQLpip install pyhive
Ascend.iopip install impyla
Azure MS SQLpip install pymssql
Big Querypip install pybigquery
ClickHousepip install clickhouse-driver==0.2.0 && pip install clickhouse-sqlalchemy==0.1.6
CockroachDBpip install cockroachdb
Dremiopip install sqlalchemy_dremio
Elasticsearchpip install elasticsearch-dbapi
Exasolpip install sqlalchemy-exasol
Google Sheetspip install shillelagh[gsheetsapi]
Fireboltpip install firebolt-sqlalchemy
Hologrespip install psycopg2
IBM Db2pip install ibm_db_sa
IBM Netezza Performance Serverpip install nzalchemy
MySQLpip install mysqlclient
Oraclepip install cx_Oracle
PostgreSQLpip install psycopg2
Trinopip install sqlalchemy-trino
Prestopip install pyhive
SAP Hanapip install hdbcli sqlalchemy-hana or pip install apache-Feris[hana]
Snowflakepip install snowflake-sqlalchemy
SQLiteNo additional library needed
SQL Serverpip install pymssql
Teradatapip install teradatasqlalchemy
Verticapip install sqlalchemy-vertica-python
Yugabytepip install psycopg2

Last updated on