Skip to content
Browse documentation
Execution engines

Supabase & ClickHouse

Discover schemas and execute queries in a remote database.

Supabase

typescript
const ava = new AVA({
  llm: { model: 'YOUR_MODEL', apiKey: process.env.OPENAI_API_KEY },
  engine: { type: 'supabase' },
});
await ava.source({
  type: 'supabase',
  options: {
    projectRef: 'YOUR_PROJECT_REF',
    accessToken: process.env.SUPABASE_ACCESS_TOKEN!,
  },
});

The engine discovers schema on demand and executes PostgreSQL queries through the Supabase Management API using read-only requests. Your application handles obtaining and refreshing the access token. Query results are returned to AVA and can be sent to the model for analysis summaries.

ClickHouse

typescript
const ava = new AVA({
  llm: { model: 'YOUR_MODEL', apiKey: process.env.OPENAI_API_KEY },
  engine: { type: 'clickhouse' },
});
await ava.source({
  type: 'clickhouse',
  options: {
    url: 'http://localhost:8123',
    database: 'analytics',
    username: 'reader',
    password: process.env.CLICKHOUSE_PASSWORD,
  },
});

Use url or host, with a required database. username takes precedence over the user alias. Queries use the official ClickHouse client with read-only settings.

SQL Server

typescript
const ava = new AVA({
  llm: { model: 'YOUR_MODEL', apiKey: process.env.OPENAI_API_KEY },
  engine: { type: 'sqlserver' },
});
await ava.source({
  type: 'sqlserver',
  options: {
    host: 'localhost',
    database: 'analytics',
    user: 'reader',
    password: process.env.SQLSERVER_PASSWORD!,
  },
});

Queries use the Node.js mssql driver with read-only T-SQL.

Snowflake

typescript
const ava = new AVA({
  llm: { model: 'YOUR_MODEL', apiKey: process.env.OPENAI_API_KEY },
  engine: { type: 'snowflake' },
});
await ava.source({
  type: 'snowflake',
  options: {
    account: 'myorg-myaccount',
    username: 'AVA_READER_SVC',
    authenticator: 'SNOWFLAKE_JWT',
    privateKeyPath: '/secure/ava_reader_key.p8',
    warehouse: 'AVA_WH',
    role: 'AVA_READER',
    database: 'ANALYTICS',
    schema: 'SALES',
  },
});

Queries run on your warehouse through the official Snowflake Node.js driver, using the role's privileges. The engine discovers one schema, accepts only statements that compile as a single query (refusing anonymous procedures and SYSTEM$ functions), and enforces queryTimeoutMs in Snowflake and on the client.

Shared workflow

All remote engines support schema(), profile(), translate(), query(), and analyze(). Set the matching source and engine types in the JavaScript API. Release resources with await ava.dispose() after use.

See Supabase parameters, ClickHouse options, SQL Server parameters, and Snowflake options for complete configuration tables.