PostgreSQL
postgres familyThe reference dialect, with extension hooks for flavours such as TimescaleDB.
- In sgl.yaml
dialect: postgres- Placeholders
$1 and named :name- Default schema
- public
- RETURNING
- yes
- Migrations
- PostgreSQL backend, each in a transaction; lock: advisory lock, or a lock table behind PgBouncer
- Live schema
- sgl schema dump --from-db and sgl schema diff
- Go drivers
- database/sql, pgx
- sgl connects with
- pgx
- Golden cases
- 87
CockroachDB
built on postgresPostgreSQL's grammar and types, under its own name.
- In sgl.yaml
dialect: cockroachdb- Placeholders
$1 and named :name- Default schema
- public
- RETURNING
- yes
- Migrations
- PostgreSQL backend, each in a transaction; lock: advisory lock
- Live schema
- sgl schema dump --from-db and sgl schema diff
- Go drivers
- database/sql, pgx
- sgl connects with
- pgx
- Golden cases
- 4
TimescaleDB
built on postgresPostgreSQL plus hypertables, continuous aggregates and Timescale's functions.
- In sgl.yaml
dialect: timescaledb- Placeholders
$1 and named :name- Default schema
- public
- RETURNING
- yes
- Migrations
- PostgreSQL backend, each in a transaction; lock: advisory lock
- Live schema
- sgl schema dump --from-db and sgl schema diff
- Go drivers
- database/sql, pgx
- sgl connects with
- pgx
Unqualified names resolve in the connection's database; RETURNING is off unless enabled.
- In sgl.yaml
dialect: mysql- Placeholders
? and named :name- Default schema
- the connection's database
- RETURNING
- opt-in
- Migrations
- MySQL backend, each in a transaction; lock: GET_LOCK advisory lock
- Live schema
- from migrations only
- Go drivers
- database/sql
- sgl connects with
- go-sql-driver/mysql
- Golden cases
- 44
MySQL's grammar with MariaDB's RETURNING on INSERT and DELETE.
- In sgl.yaml
dialect: mariadb- Placeholders
? and named :name- Default schema
- the connection's database
- RETURNING
- INSERT, DELETE
- Migrations
- MySQL backend, each in a transaction; lock: GET_LOCK advisory lock
- Live schema
- from migrations only
- Go drivers
- database/sql
- sgl connects with
- go-sql-driver/mysql
- Golden cases
- 4
Type affinity is mapped to Go types; the stock driver is pure Go.
- In sgl.yaml
dialect: sqlite- Placeholders
?1 and named :name @name $name- Default schema
- main
- RETURNING
- yes
- Migrations
- SQLite backend, each in a transaction; lock: none needed: one writer
- Live schema
- sgl schema dump --from-db and sgl schema diff
- Go drivers
- database/sql
- sgl connects with
- modernc.org/sqlite
- Golden cases
- 56
DuckDB's driver needs cgo, so the stock sgl generates code only: migrate from your own program or a custom sgl build.
- In sgl.yaml
dialect: duckdb- Placeholders
$1 and named :name- Default schema
- main
- RETURNING
- yes
- Migrations
- DuckDB backend, each in a transaction; lock: none needed: the database file admits one process
- Live schema
- from migrations only
- Go drivers
- database/sql
- sgl connects with
- none in the stock binary: build sgl with the DuckDB driver
- Golden cases
- 57
ClickHouse
clickhouse familyTyped {name:Type} parameters, asyncexec for ALTER UPDATE and DELETE, and a native-protocol emitter.
- In sgl.yaml
dialect: clickhouse- Placeholders
{name:Type}- Default schema
- default
- RETURNING
- no
- Mutations
- asynchronous: use
asyncexec - Migrations
- ClickHouse backend, without transactions; lock: none: run migrations from one place, such as CI
- Live schema
- from migrations only
- Go drivers
- database/sql, clickhouse native
- sgl connects with
- clickhouse-go
- Golden cases
- 80