Skip to main content
Version: Next

SQL

The SQL input executes a select_sql query through DataFusion to read from a database (MySQL, PostgreSQL, SQLite, DuckDB) or file format. Ballista is optional for distributed queries.

Configuration

FieldTypeRequiredDefaultDescription
typestringyesConstant value "sql"
select_sqlstringyesSQL query statement
input_typeobjectyesData source type and configuration (tagged enum), see table below
ballistaobjectnoDistributed query configuration, see table below

ballista

FieldTypeRequiredDescription
remote_urlstringyesBallista server URL

input_type

input_type is a tagged enum (distinguished by the type field). The variants are below.

mysql / postgres

FieldTypeRequiredDescription
typestringyes"mysql" or "postgres"
uristringyesDatabase connection URI
namestringnoRegistered table name (used to reference it in queries)
sslobjectyesSSL configuration, see below

ssl:

FieldTypeRequiredDescription
ssl_modestringyesSSL mode
root_certstringnoPath to the root certificate

duckdb / sqlite

FieldTypeRequiredDescription
typestringyes"duckdb" or "sqlite"
pathstringyesDatabase file path
namestringnoRegistered table name

Examples

input:
type: "sql"
select_sql: "SELECT * FROM flow"
input_type:
type: "mysql"
name: "my_mysql"
uri: "mysql://user:password@localhost:3306/db"
ssl:
ssl_mode: "verify_identity"
root_cert: "/path/to/cert.pem"
input:
type: "sql"
select_sql: "SELECT * FROM flow where id > 1000"
ballista:
remote_url: "df://localhost:50050"
input_type:
type: "sqlite"
path: "/path/to/data.db"