Skip to main content

Postgresql Bubble

Execute PostgreSQL queries with operation validation

Quick Start

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

query: null, // SQL query to execute against the PostgreSQL database (use parameterized queries with $1, $2, etc.)
credentials: {
[CredentialType.DATABASE_CRED]: process.env.DATABASE_URL as string,
},
}).action();

Operation Details

execute

ignoreSSL boolean
Ignore SSL certificate errors when connecting to the database
query unknown required
SQL query to execute against the PostgreSQL database (use parameterized queries with $1, $2, etc.)
allowedOperations 'SELECT' | 'INSERT' | 'UPDATE' | 'DELETE' | 'WITH' | 'EXPLAIN' | 'ANALYZE' | 'SHOW' | 'DESCRIBE' | 'DESC' | 'CREATE'[]
List of allowed SQL operations for security (defaults to read-only operations)
parameters unknown[]
Parameters for parameterized queries (e.g., [value1, value2] for $1, $2)
timeout number
Query timeout in milliseconds (default: 30 seconds, max recommended: 300000)
maxRows number
Maximum number of rows to return to prevent large result sets (default: 1000)
credentials Record<CredentialType,string>
Object mapping credential types to values (injected at runtime)