Skip to main content

Sql Query Tool

Execute read-only SQL queries against PostgreSQL databases for data analysis

Quick Start

import { SQLQueryTool } from '@bubblelab/bubble-core';
import { CredentialType } from '@bubblelab/shared-schemas';
const result = await new SQLQueryTool({

query: 'example', // SQL query to execute (SELECT, WITH, EXPLAIN, ANALYZE, SHOW, DESCRIBE only)
reasoning: 'example', // Explain why you're running this specific query and what you hope to learn from it
credentials: {
[CredentialType.DATABASE_CRED]: process.env.DATABASE_URL as string,
},
}).action();

Operation Details

execute

query string required
SQL query to execute (SELECT, WITH, EXPLAIN, ANALYZE, SHOW, DESCRIBE only)
reasoning string required
Explain why you're running this specific query and what you hope to learn from it
credentials Record<CredentialType,string>
Database credentials (injected at runtime)
config Record<string,unknown>
Configuration for the tool bubble