Database Config
Configure database connections, pools, TLS, supported database types, and table mapping.
Single database
sources:
- name: app
kind: database
type: postgres
default: true
connection_string: ${DATABASE_URL}
schema: public
max_open_conns: 25
max_idle_conns: 5
ping_timeout: 2sSupported database types
GraphJin has configuration examples for PostgreSQL, MySQL/MariaDB, SQLite, Oracle, SQL Server, MongoDB, Snowflake, Redshift, ClickHouse, and CodeSQL sources.
CodeSQL is not a kind: database source. Declare source-code indexes with kind: code so source capabilities, read-only behavior, and managed SQLite setup are applied correctly.
Connection pools and TLS
Use pool options to bound database concurrency and TLS options for secure connections. Prefer environment variables for secrets and connection strings.
sources:
- name: warehouse
kind: database
type: snowflake
connection_string: ${SNOWFLAKE_DSN}
private_key_path: ${SNOWFLAKE_KEY_PATH}
key_passphrase: ${SNOWFLAKE_KEY_PASSPHRASE}
- name: sqlserver
kind: database
type: mssql
connection_string: ${MSSQL_DSN}
encrypt: true
trust_server_certificate: falseTable mapping
tables:
- name: users
table: app_users
source: app
schema: public
columns:
- name: id
type: integer
primary: true
- name: account_id
type: uuid
blocked: trueTable config is where you declare aliases, schema overrides, blocklists, column metadata, named order presets, and explicit relationships when discovery is not enough.
Explicit relationships
Use relationship config when introspection cannot infer a foreign key or when a relation crosses database/source boundaries:
relationships:
- from: app.orders.customer_id
to: crm.customers.id
as: customerFor multi-database mode, root fields can be merged from several databases in one response, while nested database joins extract parent keys and replace the child placeholder query with a source-specific child query.
TestMultiDBConfigInConfig
core/multidb_test.go:113TestParseDBConfig_SnowflakeConnectionString
serv/mcp_test.go:1847