URI Connection Strings
  • 18 Oct 2024
  • 1 Minute to read
  • Dark
    Light

URI Connection Strings

  • Dark
    Light

Article summary

Connection Strings

Below is a list of connection strings for use when connecting a database using a SQLAlchemy URI.

Select linked database name for more connection details / instructions.

DatabaseConnection String
Amazon Athenaawsathena+pandas://<AWS Access Key ID>:<AWS Secret Access Key>@athena.<Region Name>.amazonaws.com/<Database Name>?s3_staging_dir=s3://<S3 Bucket>/&work_group=<Work Group>
Amazon Redshift redshift+psycopg2://<Username>:<Password>@<AWS Endpoint>:<Port(default:5439)>/<Database Name>?sslmode=verify-ca

To support Spectrum tables, please use this alternative driver: redshift+spectrum://<Username>:<Password>@<AWS Endpoint>:<Port(default:5439)>/<Database Name>?sslmode=verify-ca
Apache Drilldrill+sadrill://<Username>:<Password>@<Host>:<Port>/<Storage Plugin>?use_ssl=True
Apache Druiddruid+https://<Username>:<password>@<Host>:<Port(default:8082)>/druid/v2/sql
Apache Hivehive://<Host>:<Port(default:10000)>/<Catalog>/<Schema>
Apache Impalaimpala://<Host>:<Port>/<Database Name>?use_ssl=True
Apache Kylinkylin://<Host>:<Port>/<Database Name>?is_ssl=True
Apache Pinotpinot+https://pinot-broker.<Host>:<Port>/query?server=https://pinot-controller.<Host>:<Port>/
Apache Spark SQLjdbc+hive://
Aurora PostgreSQL (Data API)postgresql+auroradataapi://<AWS Access ID>:<AWS Secret Key>@/<Database Name>
Azure Synapsemssql+pyodbc://<Username>:<Password>@<Host>:<Port>/<Database Name>?driver=ODBC+Driver+17+for+SQL+Server

If you face an error, try including autocommit=True (might be required by your database):
mssql+pyodbc://<Username>:<Password>@<Host>:<Port>/<Database Name>?autocommit=True&driver=ODBC+Driver+17+for+SQL+Server
ClickHouseclickhousedb+connect://<Username>:<Password>@<Host>/<Database Name>?secure=true
CockroachDBcockroachdb://<Username>:<Password>@<Host>/<Database Name>?sslmode=require
Databricks Hivedatabricks+pyhive://token:<Token>@<Host>:443
Dremiodremio://<Username>:<Password>@<Host>:<Port>/<Database Name>/?SSL=1

To connect using a Personal Access Token (PAT):
dremio://$token:<Personal Access Token>@sql.dremio.cloud:443/<Project ID>;SSL=1
Elasticsearch (SQL API)elasticsearch+https://<Username>:<Password>@<Host>:<Port>/
Firebirdfirebird+fdb://<Username>:<Password>@<Host>:<Port(default:3050)>/<Path to DB>/db.fdb
Fireboltfirebolt://<Username>:<Password>@<Database Name>/<Engine Name>?account_name=<Account Name>

To connect using a service account:
firebolt://<Service Account ID>:<Service Account Secret>@<Database Name>/<Engine Name>?account_name=<Account Name>
Google BigQuerybigquery://<Project ID>
Google Sheetsgsheets://
Hanahana://<Host>?encrypt=True
IBM Db2db2+ibm_db://<Username>:<Password>@<Host>:<Port>/<Database Name>?Security=SSL
Microsoft SQL Servermssql+pymssql://<Username>:<Password>@<Host>:<Port(default:1433)>/<Database Name>
MySQLmysql+mysqlconnector://<Username>:<Password>@<Host>/<Database Name>
Oracleoracle+oracledb://<User>:<password>@<TNSName>
PostgreSQLpostgresql://<Username>:<Password>@<Host>/<Database Name>?sslmode=require
Prestopresto://<Username>:<Password>@<Host>:<Port>/<Catalog>/<Schema>?protocol=https
Rocksetrockset://apikey:<Your API Key>@api.<Rockset Region>.rockset.com
Snowflakesnowflake://<Username>:<Password>@<Account>/<Database>?role=<Role>&warehouse=<Warehouse>
Teradatateradata://
Trinotrino://<Username>:<Password>@<Host>:<Port>/<Catalog>
Verticavertica+vertica_python://<UserName>:<Password>@<Host>/<Database Name>?ssl=1

Was this article helpful?