Apache Superset-0011-连接数据库-安装数据库驱动

Apache Superset-0011-连接数据库-安装数据库驱动

1、Install Database Drivers

Superset requires a Python DB-API database driver and a SQLAlchemy dialect to be installed for each datastore you want to connect to.

SS 需要Python DB-API 数据库驱动和 SQLAlchemy 需要连接的数据库存储方言。

You can read more here about how to install new database drivers into your Superset configuration.

这里可以了解到如何为 SS 配置安装一个新的数据库驱动。

(1)支持的数据库和依赖 – Supported Databases and Dependencies

Superset does not ship bundled with connectivity to databases, except for SQLite, which is part of the Python standard library. You’ll need to install the required packages for the database you want to use as your metadata database as well as the packages needed to connect to the databases you want to access through Superset.

SS 不绑定连接到各个数据相关的驱动,除了 SQLite 数据库,这个是Python的标准库。需要单独安装数据库需要的包,不管是元数据数据库还是需要连接的分析库数据库。

(2)支持的数据库列表

  1. Amazon Athena
  2. Amazon Redshift
  3. Apache Drill
  4. Apache Druid
  5. Apache Hive
  6. Apache Impala
  7. Apache Kylin
  8. Apache Pinot
  9. Apache Solr
  10. Apache Spark SQL
  11. Ascend.io
  12. Azure MS SQL
  13. Big Query
  14. ClickHouse
  15. CockroachDB
  16. Dremio
  17. Elasticsearch
  18. Exasol
  19. Google Sheets
  20. Firebolt
  21. Hologres
  22. IBM Db2
  23. IBM Netezza Performance Server
  24. MySQL
  25. Oracle
  26. PostgreSQL
  27. Trino
  28. Presto
  29. SAP Hana
  30. Snowflake
  31. SQLite
  32. SQL Server
  33. Teradata
  34. Vertica
  35. YugabyteDB

3)安装派森包

A list of some of the recommended packages.

建议安装的包:

# Amazon Athena
pip install "PyAthenaJDBC>1.0.9"
pip install "PyAthena>1.2.0"

# Amazon Redshift
pip install sqlalchemy-redshift

# Apache Drill
pip install sqlalchemy-drill

# Apache Druid
pip install pydruid

# Apache Hive
pip install pyhive

# Apache Impala
pip install impyla

# Apache Kylin
pip install kylinpy

# Apache Pinot
pip install pinotdb

# Apache Solr
pip install sqlalchemy-solr

# Apache Spark SQL
pip install pyhive

# Ascend.io
pip install impyla

# Azure MS SQL
pip install pymssql

# Big Query
pip install pybigquery

# ClickHouse
pip install clickhouse-driver==0.2.0 && pip install clickhouse-sqlalchemy==0.1.6

# CockroachDB
pip install cockroachdb

# Dremio
pip install sqlalchemy_dremio

# Elasticsearch
pip install elasticsearch-dbapi

# Exasol
pip install sqlalchemy-exasol

# Google Sheets
pip install shillelagh[gsheetsapi]

# Firebolt
pip install firebolt-sqlalchemy

# Hologres
pip install psycopg2

# IBM Db2
pip install ibm_db_sa

# IBM Netezza Performance Server
pip install nzalchemy

# MySQL
pip install mysqlclient

# Oracle
pip install cx_Oracle

# PostgreSQL
pip install psycopg2

# Trino
pip install sqlalchemy-trino

# Presto
pip install pyhive

# SAP Hana
pip install hdbcli sqlalchemy-hana or pip install apache-superset[hana]

# Snowflake
pip install snowflake-sqlalchemy

# SQLite
# No additional library needed

# SQL Server
pip install pymssql

# Teradata
pip install teradatasqlalchemy

# Vertica
pip install sqlalchemy-vertica-python

# YugabyteDB
pip install psycopg2

(4)数据库连接字符串

# Amazon Athena
awsathena+rest://{aws_access_key_id}:{aws_secret_access_key}@athena.{region_name}.amazonaws.com/{

# Amazon Redshift
redshift+psycopg2://:@:5439/

# Apache Drill
drill+sadrill:// For JDBC drill+jdbc://

# Apache Druid
druid://:@:/druid/v2/sql

# Apache Hive
hive://hive@{hostname}:{port}/{database}

# Apache Impala
impala://{hostname}:{port}/{database}

Apache Kylin
# kylin://:@:/?=&=

# Apache Pinot
pinot://BROKER:5436/query?server=http://CONTROLLER:5983/

# Apache Solr
solr://{username}:{password}@{hostname}:{port}/{server_path}/{collection}

# Apache Spark SQL
hive://hive@{hostname}:{port}/{database}

Ascend.io
# ascend://{username}:{password}@{hostname}:{port}/{database}?auth_mechanism=PLAIN;use_ssl=true

Azure MS SQL
# mssql+pymssql://UserName@presetSQL:TestPassword@presetSQL.database.windows.net:1433/TestSchema

# Big Query
bigquery://{project_id}

# ClickHouse
clickhouse+native://{username}:{password}@{hostname}:{port}/{database}

# CockroachDB
cockroachdb://root@{hostname}:{port}/{database}?sslmode=disable

# Dremio
dremio://user:pwd@host:31010/

# Elasticsearch
elasticsearch+http://{user}:{password}@{host}:9200/

Exasol
# exa+pyodbc://{username}:{password}@{hostname}:{port}/my_schema?CONNECTIONLCALL=en_US.UTF-8&driver=EXAODBC

# Google Sheets
gsheets://

Firebolt
# firebolt://{username}:{password}@{database} or firebolt://{username}:{password}@{database}/{engine_name}

# Hologres
postgresql+psycopg2://:@/

# IBM Db2
db2+ibm_db://

# IBM Netezza Performance Server
netezza+nzpy://:@/

# MySQL
mysql://:@/

# Oracle
oracle://

# PostgreSQL
postgresql://:@/

# Trino
trino://{username}:{password}@{hostname}:{port}/{catalog}

# Presto
presto://

# SAP Hana
hana://{username}:{password}@{host}:{port}

Snowflake
# snowflake://{user}:{password}@{account}.{region}/{database}?role={role}&warehouse={warehouse}

# SQLite
sqlite://

# SQL Server
mssql://

# Teradata
teradata://{user}:{password}@{host}

# Vertica
vertica+vertica_python://:@/

# YugabyteDB
postgresql://:@/

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.

注意:其他很多数据库也支持,主要的条件是 SQLAlchemy 方言及相关派森驱动是否存在。搜索一下“sqlalchemy+数据库名字”就会发现。

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

如果数据库或者数据引擎不在上述列表上,但是存在 SQL 接口,请在 SS GitHub 代码仓库提交一个请求,这样我们就可以编写文档以及支持他。

If you’d like to build a database connector for Superset integration, read the following tutorial.

如果想为 SS 构建并集成一个数据库连接器,参考接下来的教程

Apache Superset-0011-连接数据库-安装数据库驱动 Comment

发表回复

京ICP备15027918号-1