Skip to content

Databases ​

DatabaseStatus
MySQL / MariaDBAvailable. Tables, views, and MariaDB system-versioned tables.
PostgreSQLAvailable. Tables, partitioned tables, views, materialized views, and schemas.
SQLiteNot in 0.2.0.
OthersImplement the DatabaseAdapter interface from the SDK.

Set DB_DRIVER to mysql (MariaDB uses the same driver) or postgres. Connection settings are in Configuration.

Use a read-only account ​

Create a dedicated user with only the privileges dbask needs: SELECT on the tables it may see. Do not give it access to unrelated databases, sensitive tables or columns.

sql
-- MySQL / MariaDB
CREATE USER 'dbask_ro'@'%' IDENTIFIED BY 'a-strong-password';
GRANT SELECT ON your_database.* TO 'dbask_ro'@'%';
sql
-- PostgreSQL
CREATE ROLE dbask_ro LOGIN PASSWORD 'a-strong-password';
GRANT CONNECT ON DATABASE your_database TO dbask_ro;
GRANT USAGE ON SCHEMA public TO dbask_ro;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO dbask_ro;

Adjust the host part and schema names to your setup. A read-only account is one layer; see the Safety model for the others.

Differences between the adapters ​

MySQL / MariaDBPostgreSQL
Read-only enforcementREAD ONLY session and transaction, always rolled backREAD ONLY transaction, always rolled back
TimeoutQuery is cancelled on the server with KILL QUERYstatement_timeout
Large resultsFetched fully, then limited to SQL_MAX_ROWSStreamed through a cursor, so oversized results are never fully loaded
Multiple statementsRefused by the SQL validatorRefused by the validator and by the server (extended protocol)
ViewsListedListed, including materialized views

Results that hit the row or size limit are flagged truncated, and the agent is told not to present them as complete.

Foreign keys ​

The agent plans joins from declared foreign keys. If your database relies on undeclared relationships (common in older systems), say so in dbask.md, because dbask cannot discover them.

Released under the ISC License.