Skip to content

Query Runner

The Query Runner is Mako’s database abstraction layer. It provides a single interface to execute queries across all supported databases, handling connection management, dialect differences, and result formatting.

DatabaseDriverConnection Type
PostgreSQLpostgresqlHost/port or connection string
Cloud SQL (Postgres)cloudsql-postgresInstance connection name
BigQuerybigqueryProject ID + service account
MongoDBmongodbConnection string
MySQLmysqlHost/port
ClickHouseclickhouseHost/port
RedshiftredshiftHost/port (PostgreSQL wire protocol)
SQLitesqliteFile path
Cloudflare D1cloudflare-d1Account ID + database ID

In the Mako UI:

  1. Click Databases in the sidebar
  2. Click Add Connection
  3. Select the database type
  4. Enter connection details
  5. Click Test Connection to verify
  6. Save

If your database requires IP whitelisting, add Mako’s static outbound IP:

34.79.190.46

Atlas connection strings need the database name as a path segment, not a query parameter:

# What Atlas gives you:
mongodb+srv://user:pass@cluster.mongodb.net/?appName=Cluster
# What Mako needs:
mongodb+srv://user:pass@cluster.mongodb.net/DatabaseName

The Query Runner uses a driver registry pattern. Each database type has a driver that implements:

  • Connection pooling — Connections are cached and reused
  • Query execution — Takes SQL/MongoDB queries and returns structured results
  • Schema inspection — Lists databases, tables, columns, and sample data
  • Dialect handling — Identifier quoting, type casting, and syntax differences

The AI agent uses the Query Runner under the hood — when it calls sql_execute_query, the Query Runner resolves the correct driver, executes against the right database, and returns results.