add-database-driver
Scaffold a new database driver for the Mako multi-database query execution system. Use when adding support for a new database type.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Scaffold a new database driver for the Mako multi-database query execution system. Use when adding support for a new database type.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Load when building, editing, or debugging Mako React apps — app files, npm dependencies, data bindings, the @mako/app-sdk hooks (useQuery / useDuckDB / useLocation / useSearchParams / navigate), URL state and shareable deep links, materialized Parquet/DuckDB bindings, and the live preview runtime.
Load for dbt branches, commits, pushes, pull requests, merges, repository sync, or branch cleanup.
Load when creating, editing, scheduling, running, or debugging dbt jobs and production deployments.
Load when building, editing, running, or debugging dbt models, dbt projects, schema.yml tests, sources, seeds, snapshots, incremental models, materializations, or dbt jobs in the Transforms section.
Load when creating, editing, configuring, validating, or debugging database sync flows, connector flows, pagination, incremental sync, destination mappings, and flow form fields.
Add a new MCP server preset (connector) to Mako's MCP client system — server URL, auth model (OAuth DCR, pre-registered app, or API key), scopes, icon, tests, and docs. Use when connecting a new external MCP server (like Slack or Close CRM) or changing how MCP connections authenticate.
| name | add-database-driver |
| description | Scaffold a new database driver for the Mako multi-database query execution system. Use when adding support for a new database type. |
Database drivers implement the DatabaseDriver interface and are registered in the driver registry. They enable query execution, schema introspection, and tree navigation for a database type.
mkdir -p api/src/databases/drivers/<name>
Create api/src/databases/drivers/<name>/index.ts:
import {
DatabaseDriver,
DatabaseDriverMetadata,
DatabaseTreeNode,
} from "../../driver";
import { IDatabaseConnection } from "../../../database/workspace-schema";
export class MyDbDriver implements DatabaseDriver {
getMetadata(): DatabaseDriverMetadata {
return {
type: "mydb",
name: "MyDB",
description: "MyDB database driver",
icon: "mydb",
};
}
async getTreeRoot(
database: IDatabaseConnection,
): Promise<DatabaseTreeNode[]> {
// Return top-level tree nodes (databases, schemas, etc.)
}
async getChildren(
database: IDatabaseConnection,
parent: { kind: string; id: string; metadata?: any },
): Promise<DatabaseTreeNode[]> {
// Return child nodes for the tree explorer
}
async executeQuery(
database: IDatabaseConnection,
query: string,
options?: { signal?: AbortSignal },
): Promise<{
success: boolean;
data?: any;
error?: string;
rowCount?: number;
}> {
// Execute the query, respect options.signal for cancellation
}
async cancelQuery?(
executionId: string,
): Promise<{ success: boolean; error?: string }> {
// Cancel a running query if supported
}
// Optional: implement supportsWrites(), insertBatch(), etc.
}
Edit api/src/databases/registry.ts and add the registration:
import { MyDbDriver } from "./drivers/mydb";
// In the initialization section:
databaseRegistry.register(new MyDbDriver());
pnpm dev| Method | Required | Purpose |
|---|---|---|
getMetadata() | Yes | Returns driver type, name, description |
getTreeRoot() | Yes | Top-level tree nodes for database explorer |
getChildren() | Yes | Child nodes for tree expansion |
executeQuery() | Yes | Query execution with AbortSignal support |
cancelQuery() | No | Cancel running queries |
getAutocompleteData() | No | Schema info for SQL autocomplete |
supportsWrites() | No | Enable write operations |
insertBatch() | No | Batch insert for sync targets |
AbortSignal in executeQuery.database-connection.service.ts to resolve connections.api/src/databases/driver.tsapi/src/databases/registry.tsapi/src/databases/drivers/postgresql/api/src/services/database-connection.service.ts