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
- Input Schema
- Output Schema
ignoreSSLboolean- Ignore SSL certificate errors when connecting to the database
queryunknown 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)
parametersunknown[]- Parameters for parameterized queries (e.g., [value1, value2] for $1, $2)
timeoutnumber- Query timeout in milliseconds (default: 30 seconds, max recommended: 300000)
maxRowsnumber- Maximum number of rows to return to prevent large result sets (default: 1000)
credentialsRecord<CredentialType,string>- Object mapping credential types to values (injected at runtime)
rowsRecord<string,unknown>[] required- Array of result rows, each row is an object with column names as keys
rowCountnumber required- Number of rows affected by the query (null for SELECT queries)
commandstring required- SQL command that was executed (SELECT, INSERT, UPDATE, DELETE)
fieldsobject[]- Metadata about the columns returned by the query
executionTimenumber required- Query execution time in milliseconds
successboolean required- Whether the query executed successfully
errorstring required- Error message if query execution failed (empty string if successful)
cleanedJSONStringstring required- Clean JSON string representation of the row data, suitable for AI prompts and integrations