sqliac-postgres
PostgreSQL adapter for SQLIaC — a Terraform alternative for SQL databases that uses no state file.
This package provides the PostgreSQL database connector and credential handling so SQLIaC can query Postgres's live state and execute DDL to reconcile your declared resource definitions.
Installation
pip install sqliac-postgres
This also installs sqliac (the CLI and core engine) and pg8000 (a pure-Python PostgreSQL driver).
Quick Start
Credentials
SQLIaC looks for Postgres credentials in two places, in order of precedence:
1. Environment variables (recommended)
export POSTGRES_HOST="localhost"
export POSTGRES_USER="my_user"
export POSTGRES_PASSWORD="my_password"
export POSTGRES_DATABASE="my_db"
# Optional:
export POSTGRES_PORT="5432"
export POSTGRES_SSLMODE="require"
2. Configuration file .sqliac/provider/credentials.toml
[postgres]
host = "localhost"
user = "my_user"
password = "my_password"
database = "my_db"
Environment variables take precedence. Run sqliac init to scaffold this file.
Using SQLIaC with Postgres
# Scaffold a project
sqliac init
# Configure your credentials and edit definitions/
# then preview and apply:
sqliac apply --dry-run
sqliac apply
Provider config
The adapter is registered via the sqliac.adapters entry point group. Your .sqliac/provider/config.toml should start with a top-level [postgres] section:
[postgres.schema.ddl_command]
create = "CREATE"
alter = "ALTER"
drop = "DROP"
[postgres.schema.ddl_context]
object_name = "analytics"
owner = "analytics_owner"
wait_time = 0
[postgres.schema.ddl_context.depends_on]
API
The adapter exposes three classes, all available from the top-level package:
from sqliac_postgres import PostgresAdapter, PostgresCredentials, PostgresConnectionManager
| Class | Role |
|---|---|
PostgresAdapter |
Concrete BaseAdapter — executes queries and manages connections |
PostgresCredentials |
Frozen dataclass — validates and stores host, user, password, database, etc. |
PostgresConnectionManager |
Thread-safe per-thread connection pool (autocommit, so DDL runs outside transaction blocks) |
All three are registered via the entry point sqliac.adapters / postgres and resolved automatically by the SQLIaC CLI. You don't need to import them directly unless building custom tooling.
Supported credential fields
| Field | Required | Env var |
|---|---|---|
host |
Yes | POSTGRES_HOST |
user |
Yes | POSTGRES_USER |
password |
Yes | POSTGRES_PASSWORD |
database |
Yes | POSTGRES_DATABASE |
port |
No (default 5432) | POSTGRES_PORT |
sslmode |
No | POSTGRES_SSLMODE |
License
MIT — see the sqliac package for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqliac_postgres-0.1.0.tar.gz.
File metadata
- Download URL: sqliac_postgres-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d159acee9a9fa7f72a8eb8f551e339e8d0f4c2627b22b086bdcabe6518ec5f64
|
|
| MD5 |
fef068a4ef6dc7f8dffd190ba6f6de48
|
|
| BLAKE2b-256 |
f42463d768eaa9e78d16895871eb7af6429e94477e997837fd726cd75385f2a1
|
File details
Details for the file sqliac_postgres-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sqliac_postgres-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2acce1eda55875f3f7b5ef7e471553e1a93581bc24dd4f6e73647a9e5c9488b
|
|
| MD5 |
13bae0d5d08d6ed4cd94c64f36a1d53f
|
|
| BLAKE2b-256 |
dc2212b0f4bba301804f0055fb66140d80661d93ec7fc9458e2356c99b9b2db8
|