Skip to content

Database Connectors ​

Faucet supports seven SQL databases: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, Snowflake and SQLite. Each database is connected as a service, a named reference to a single database that becomes an API namespace at /api/v1/<name>.

Three ways to connect ​

Admin UI (easiest). Open Databases → Add database, pick the engine, and fill in host, port, database, username and password, the same details you'd give any database client. Click Test connection to check them before saving: Faucet connects, counts your tables, and shows a plain-language hint if something is wrong. You never write a connection string, and special characters in passwords need no escaping. See Admin UI for a walkthrough with screenshots.

Adding a PostgreSQL database in the admin UI

CLI fields. faucet db add accepts the same details as flags and builds the connection string for you:

bash
faucet db add --name mydb --driver postgres \
  --host db.example.com --user api --password 's3cret@!' --database mydb --ssl-mode require

Connection string (DSN). If you already have a DSN, paste it into the UI's Connection string tab, pass --dsn, or send dsn to the API. Each section below documents the DSN format and its useful parameters.

DatabaseDriver nameUI fields
PostgreSQLpostgresHost, port (5432), database, username, password, SSL mode
MySQLmysqlHost, port (3306), database, username, password, TLS
MariaDBmysqlSame as MySQL
SQL ServermssqlHost, port (1433), database, username, password, encryption, trust server certificate
OracleoracleHost, port (1521), service name, username, password, TLS
SnowflakesnowflakeAccount identifier, username, password or key-pair file, database, schema, warehouse, role
SQLitesqliteFile path on the Faucet server

Supported versions ​

DatabaseVersionsHosted optionsDriver
PostgreSQL9.6 – 17Amazon RDS, Aurora, Supabase, Neon, Azure Databasepostgres
MySQL5.7 – 9.xAmazon RDS, Aurora MySQL, PlanetScale, Azure MySQLmysql
MariaDB10.2 – 11.xSkySQL, Amazon RDS for MariaDBmysql
SQL Server2012 – 2022Azure SQL Database, Amazon RDSmssql
Oracle12c – 26aiOracle Cloud (OCI), Amazon RDS, Azureoracle
SnowflakeCurrentAWS, Azure, GCPsnowflake
SQLite3.35+Local file, in-memorysqlite

All connectors implement the same Connector interface, which provides:

  • Connection management (connect, disconnect, ping)
  • Schema introspection (tables, columns, views, stored procedures)
  • Query building (SELECT, INSERT, UPDATE, DELETE with dialect-specific SQL)
  • Schema modification (CREATE TABLE, ALTER TABLE, DROP TABLE)
  • Stored procedure execution

PostgreSQL ​

Driver name: postgres

DSN Format ​

postgres://username:password@host:port/database?sslmode=disable

Or the keyword/value format:

host=localhost port=5432 user=myuser password=mypass dbname=mydb sslmode=disable

Common DSN Parameters ​

ParameterDefaultDescription
sslmoderequireSSL mode: disable, require, verify-ca, verify-full
search_pathpublicDefault schema
connect_timeout--Connection timeout in seconds
application_name--Application name for pg_stat_activity

Passwords with special characters: the admin UI fields and the CLI --password flag need no escaping. In a DSN, URL-encode special characters (a password of Pa@ss#1 becomes Pa%40ss%231). Faucet also repairs raw @, #, : and / in the password, and leaves already-encoded values alone, but a raw ? always has to be encoded as %3F.

DSN Examples ​

bash
# Local development
postgres://localhost/mydb?sslmode=disable

# Remote with SSL
postgres://user:pass@db.example.com:5432/production?sslmode=require

# With search path
postgres://user:pass@localhost/mydb?sslmode=disable&search_path=myschema

# Amazon RDS
postgres://admin:secret@mydb.abc123.us-east-1.rds.amazonaws.com:5432/mydb?sslmode=require

Supported Features ​

FeatureSupported
Schema introspectionYes
RETURNING clauseYes
Upsert (ON CONFLICT)Yes
Stored proceduresYes
ViewsYes
Parameter style$1, $2, $3
Default schemapublic

Adding via CLI ​

bash
faucet db add \
  --name mypostgres \
  --driver postgres \
  --dsn "postgres://user:pass@localhost:5432/mydb?sslmode=disable"

MySQL ​

Driver name: mysql

DSN Format ​

username:password@tcp(host:port)/database?parseTime=true

Common DSN Parameters ​

ParameterDefaultDescription
parseTimefalseParse DATE/DATETIME to time.Time (recommended: true)
charsetutf8mb4Character set
collationutf8mb4_general_ciCollation
tlsfalseTLS mode: true, false, skip-verify, or custom name
timeout--Connection timeout (e.g., 5s)
readTimeout--I/O read timeout
writeTimeout--I/O write timeout
multiStatementsfalseAllow multiple statements in one query

DSN Examples ​

bash
# Local development
root:password@tcp(localhost:3306)/mydb?parseTime=true

# Remote with TLS
user:pass@tcp(db.example.com:3306)/production?parseTime=true&tls=true

# With charset
user:pass@tcp(localhost:3306)/mydb?parseTime=true&charset=utf8mb4

# Amazon RDS
admin:secret@tcp(mydb.abc123.us-east-1.rds.amazonaws.com:3306)/mydb?parseTime=true&tls=true

Supported Features ​

FeatureSupported
Schema introspectionYes
RETURNING clauseNo
Upsert (ON DUPLICATE KEY)Yes
Stored proceduresYes
ViewsYes
Parameter style?
Default schemadatabase name

Note: Without RETURNING support, INSERT operations return the submitted records rather than the server-generated values. Use a subsequent GET to retrieve auto-incremented IDs.

Adding via CLI ​

bash
faucet db add \
  --name mymysql \
  --driver mysql \
  --dsn "user:pass@tcp(localhost:3306)/mydb?parseTime=true"

MariaDB ​

Driver name: mysql

MariaDB speaks the MySQL protocol, so Faucet connects to it with the MySQL driver. Everything in the MySQL section applies: the DSN format, the parameters, and the features. In the admin UI, MariaDB has its own tile with the same fields as MySQL. Once saved, the database is listed with the mysql driver.

Tested with MariaDB 10.2 through 11.x, including SkySQL and Amazon RDS for MariaDB.

bash
faucet db add --name shop --driver mysql \
  --host mariadb.internal --user app --password secret --database shop

As with MySQL, Faucet does not use RETURNING, so inserts return the submitted records; read auto-incremented IDs back with a follow-up GET.


SQL Server ​

Driver name: mssql

DSN Format ​

sqlserver://username:password@host:port?database=dbname

Or using ADO-style connection string:

server=host;port=1433;user id=username;password=password;database=dbname

Common DSN Parameters ​

ParameterDefaultDescription
database--Database name
encryptfalseEnable encryption: true, false, disable
TrustServerCertificatefalseTrust self-signed certificates
app name--Application name
connection timeout0Connection timeout in seconds

Passwords with special characters: the admin UI fields and the CLI --password flag need no escaping. In a DSN, URL-encode special characters (a password of Pa@ss#1 becomes Pa%40ss%231). Faucet also repairs raw @, #, : and / in the password, and leaves already-encoded values alone, but a raw ? always has to be encoded as %3F.

DSN Examples ​

bash
# Local development
sqlserver://sa:YourStrong!Passw0rd@localhost:1433?database=mydb

# Remote with encryption
sqlserver://user:pass@db.example.com:1433?database=production&encrypt=true

# Trust self-signed cert (development only)
sqlserver://sa:password@localhost:1433?database=mydb&encrypt=true&TrustServerCertificate=true

# Azure SQL
sqlserver://admin:secret@myserver.database.windows.net:1433?database=mydb&encrypt=true

Supported Features ​

FeatureSupported
Schema introspectionYes
RETURNING clauseVia OUTPUT clause
Upsert (MERGE)Yes
Stored proceduresYes
ViewsYes
Parameter style@p1, @p2, @p3
Default schemadbo

Adding via CLI ​

bash
faucet db add \
  --name mymssql \
  --driver mssql \
  --dsn "sqlserver://sa:YourStrong!Passw0rd@localhost:1433?database=mydb"

Snowflake ​

Driver name: snowflake

DSN Format ​

account_identifier/database/schema?user=username&password=password&warehouse=wh

Or using the Snowflake Go driver format:

username:password@account_identifier/database/schema?warehouse=wh&role=role

Common DSN Parameters ​

ParameterDefaultDescription
warehouse--Snowflake warehouse
role--Snowflake role
schemaPUBLICDefault schema
authenticator--Auth type: snowflake (default), externalbrowser, oauth, SNOWFLAKE_JWT
token--OAuth access token (when authenticator=oauth)
loginTimeout60Login timeout in seconds

DSN Examples ​

bash
# Basic connection (username/password)
user:pass@myaccount/mydb/public?warehouse=COMPUTE_WH

# With role
user:pass@myaccount/mydb/public?warehouse=COMPUTE_WH&role=ANALYST

# Full URL format
user:pass@myorg-myaccount/mydb/PUBLIC?warehouse=COMPUTE_WH&role=DATA_READER

Key Pair (JWT) Authentication ​

For environments where username/password is not permitted, Faucet supports Snowflake key pair authentication using RSA private keys.

1. Generate an RSA key pair:

bash
# Generate PKCS#8 private key (recommended)
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out snowflake_key.p8

# Extract the public key
openssl pkey -in snowflake_key.p8 -pubout -out snowflake_key.pub

2. Register the public key in Snowflake:

sql
ALTER USER MY_USER SET RSA_PUBLIC_KEY='MIIBIjANBg...';

(Paste the key contents without the -----BEGIN/END PUBLIC KEY----- headers.)

3. Configure the service with private_key_path:

bash
# Via CLI — no password needed in the DSN
faucet db add \
  --name analytics \
  --driver snowflake \
  --dsn "MY_USER@myorg-myaccount/ANALYTICS/PUBLIC?warehouse=COMPUTE_WH" \
  --private-key-path /path/to/snowflake_key.p8

Via API:

json
{
  "name": "analytics",
  "driver": "snowflake",
  "dsn": "MY_USER@myorg-myaccount/ANALYTICS/PUBLIC?warehouse=COMPUTE_WH",
  "private_key_path": "/path/to/snowflake_key.p8"
}

Via YAML config:

yaml
services:
  - name: analytics
    driver: snowflake
    dsn: "MY_USER@myorg-myaccount/ANALYTICS/PUBLIC?warehouse=COMPUTE_WH"
    private_key_path: /path/to/snowflake_key.p8

Supported PEM formats: PKCS#8 (PRIVATE KEY) and PKCS#1 (RSA PRIVATE KEY).

Supported Features ​

FeatureSupported
Schema introspectionYes
RETURNING clauseNo
UpsertNo
Stored proceduresYes
ViewsYes
Key pair (JWT) authYes
Parameter style?
Default schemaPUBLIC

Adding via CLI ​

bash
# Username/password
faucet db add \
  --name mysnowflake \
  --driver snowflake \
  --dsn "user:pass@myaccount/mydb/public?warehouse=COMPUTE_WH"

# Key pair authentication
faucet db add \
  --name mysnowflake \
  --driver snowflake \
  --dsn "user@myaccount/mydb/public?warehouse=COMPUTE_WH" \
  --private-key-path /path/to/key.p8

Oracle ​

Driver name: oracle

Faucet connects to Oracle Database (12c through 26ai) using the pure-Go go-ora driver. No Oracle Instant Client or OCI libraries are required.

DSN Format ​

oracle://username:password@host:port/service_name

Common DSN Parameters ​

ParameterDefaultDescription
sslfalseEnable SSL/TLS: true, false
ssl verifytrueVerify server certificate
connect timeout15Connection timeout in seconds
TRACE FILE--Path to trace file for debugging

Passwords with special characters: the admin UI fields and the CLI --password flag need no escaping. In a DSN, URL-encode special characters (a password of Pa@ss#1 becomes Pa%40ss%231). Faucet also repairs raw @, #, : and / in the password, and leaves already-encoded values alone, but a raw ? always has to be encoded as %3F.

DSN Examples ​

bash
# Local development
oracle://system:password@localhost:1521/XEPDB1

# Remote with service name
oracle://appuser:secret@db.example.com:1521/PROD

# Oracle Cloud (OCI)
oracle://admin:MyP%40ssword@adb.us-ashburn-1.oraclecloud.com:1522/mydb_tp?ssl=true

# Amazon RDS for Oracle
oracle://admin:secret@mydb.abc123.us-east-1.rds.amazonaws.com:1521/ORCL

# With connect timeout
oracle://user:pass@db.example.com:1521/PROD?connect timeout=30

Supported Features ​

FeatureSupported
Schema introspectionYes
RETURNING clauseNo
Upsert (MERGE)No
Stored proceduresYes
ViewsYes
Parameter style:1, :2, :3
Default schemaCurrent user
PaginationOFFSET/FETCH (12c+)

Note: Oracle uses OFFSET n ROWS FETCH NEXT m ROWS ONLY for pagination (requires Oracle 12c or later; tested through 26ai). Without RETURNING support in the standard query path, INSERT operations return the submitted records rather than server-generated values.

Schema (Owner) ​

In Oracle, the schema is equivalent to the database user (owner). By default, Faucet uses the connected user's schema. Override with --schema:

bash
faucet db add \
  --name myoracle \
  --driver oracle \
  --dsn "oracle://appuser:pass@localhost:1521/XEPDB1" \
  --schema HR

Adding via CLI ​

bash
faucet db add \
  --name myoracle \
  --driver oracle \
  --dsn "oracle://user:pass@localhost:1521/XEPDB1"

SQLite ​

Driver name: sqlite

DSN Format ​

/path/to/database.db?param=value

Or for an in-memory database:

:memory:

Common DSN Parameters ​

ParameterDefaultDescription
_journal_modedeleteSet to WAL for better concurrent read performance
_busy_timeout5000Milliseconds to wait when the database is locked
_foreign_keysonEnable foreign key enforcement
_cache_size-2000Page cache size (negative = KB, positive = pages)

DSN Examples ​

bash
# Local file
/var/lib/faucet/mydata.db

# With WAL mode (recommended)
/var/lib/faucet/mydata.db?_journal_mode=WAL

# With WAL and busy timeout
/var/lib/faucet/mydata.db?_journal_mode=WAL&_busy_timeout=10000

# In-memory (ephemeral, for testing)
:memory:

Supported Features ​

FeatureSupported
Schema introspectionYes
RETURNING clauseYes (SQLite 3.35+)
Upsert (ON CONFLICT)Yes
Stored proceduresNo
ViewsYes
Parameter style?
Default schemamain

Note: SQLite does not support stored procedures. The _proc endpoint returns an error for SQLite services.

Adding via CLI ​

bash
faucet db add \
  --name mydata \
  --driver sqlite \
  --dsn "/path/to/mydata.db?_journal_mode=WAL"

Connection Pool Configuration ​

Each service has its own connection pool. Configure it when creating the service via the API:

json
{
  "name": "mydb",
  "driver": "postgres",
  "dsn": "postgres://...",
  "pool": {
    "max_open_conns": 100,
    "max_idle_conns": 25,
    "conn_max_lifetime": "5m",
    "conn_max_idle_time": "1m"
  }
}

Pool Settings ​

SettingDefaultDescription
max_open_conns100Maximum number of open connections to the database
max_idle_conns25Maximum number of idle connections in the pool
conn_max_lifetime5 minutesMaximum time a connection can be reused
conn_max_idle_time1 minuteMaximum time a connection can sit idle

Tuning Guidelines ​

  • Small/dev: max_open_conns=10, max_idle_conns=2
  • Medium production: max_open_conns=100, max_idle_conns=25 (defaults)
  • High traffic: max_open_conns=200-500, max_idle_conns=50-100
  • Serverless databases (Snowflake, Aurora Serverless): Lower max_open_conns to respect provider limits
  • SQLite: max_open_conns=1, max_idle_conns=1 (SQLite supports only one writer at a time)

Keep conn_max_lifetime shorter than the database server's connection timeout to avoid stale connections.


Schema Exposure ​

By default, Faucet exposes the database's default schema:

DatabaseDefault Schema
PostgreSQLpublic
MySQL(the database itself)
SQL Serverdbo
Oracle(connected user)
SnowflakePUBLIC
SQLitemain

Override with the --schema flag when adding a service or the schema field in the API:

bash
faucet db add \
  --name mydb \
  --driver postgres \
  --dsn "postgres://..." \
  --schema custom_schema

Read-Only and Raw SQL Modes ​

Each service supports two security flags:

FlagDefaultDescription
read_onlyfalseOnly allow GET requests (no INSERT, UPDATE, DELETE, DDL)
raw_sql_allowedfalseAllow raw SQL execution via the MCP faucet_raw_sql tool

Set via the system API:

bash
curl -X PUT http://localhost:8080/api/v1/system/service/mydb \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"is_active": true, "read_only": true, "raw_sql_allowed": false}'

Testing a Connection ​

In the admin UI, Test connection in the add/edit drawer checks unsaved settings, and Test on a database row checks a saved one.

To check settings over the API without saving them, use POST /api/v1/system/connection/test.

Use the CLI to verify connectivity:

bash
faucet db test mydb

Or via the API -- a successful GET to /_table confirms the connection is working:

bash
curl http://localhost:8080/api/v1/mydb/_table \
  -H "Authorization: Bearer $TOKEN"