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");
- MySQL:
"jdbc:verdict:mysql://localhost:8080/test"
- PostgreSQL:
"jdbc:verdict:postgresql://localhost:5432/database"
- Redshift:
"jdbc:verdict:redshift://host:5439/dev"
- Impala:
"jdbc:verdict:impala://localhost:21050/default"
- 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.
- MySQL:
pyverdict.mysql(host, user, password=None, port=3306)
- PostgreSQL:
pyverdict.postgres(host, port, dbname, user, password=None)
- Redshift:
pyverdict.redshift(host, port, dbname='', user=None, password=None)
- Impala:
pyverdict.impala(host, port, schema=None, user=None, password=None)
- Presto:
pyverdict.presto(host, catalog, user, password=None, port=8081)
Apache Spark¶
(Documentation not ready)