Skip to content

Connecting to Databases

VerdictDB can process the data stored in a SQL-supported database; therefore, no data migration is required outside your database. VerdictDB works with them by performing its operations in SQL.

Supported Databases

Database VerdictDB PyVerdict
MySQL ≥ 5.5 ≥ 5.5
PostgreSQL ≥ 10 ≥ 10
Amazon Redshift Supported Supported
Impala ≥ 2.5 (CDH ≥ 5.7) ≥ 2.5 (CDH ≥ 5.7)
Presto Supported Supported
Spark ≥ 2.0 Not Supported

Making a Connection in Java

VerdictDB offers the standard JDBC interface. If the verdict keyword appears after jdbc:, Java uses VerdictDB to connect to a backend database. In general, they have the following pattern:

Connection vc = DriverManager.getConnection("connection_string", "user", "password");

  1. MySQL: "jdbc:verdict:mysql://localhost:8080/test"
  2. PostgreSQL: "jdbc:verdict:postgresql://localhost:5432/database"
  3. Redshift: "jdbc:verdict:redshift://host:5439/dev"
  4. Impala: "jdbc:verdict:impala://localhost:21050/default"
  5. Presto: "jdbc:verdict:presto://localhost:8080/default"

For more details on configuration options, see this page.

Making a Connection in PyVerdict

pyverdict offers simple APIs to make connections to backend databases. A pyverdict.VerdictContext object is returned after making a connection. Unique methods are offered for different types of databases.

  1. MySQL: pyverdict.mysql(host, user, password=None, port=3306)
  2. PostgreSQL: pyverdict.postgres(host, port, dbname, user, password=None)
  3. Redshift: pyverdict.redshift(host, port, dbname='', user=None, password=None)
  4. Impala: pyverdict.impala(host, port, schema=None, user=None, password=None)
  5. Presto: pyverdict.presto(host, catalog, user, password=None, port=8081)

Apache Spark

(Documentation not ready)