Databases

Query And Seed PostgreSQL

Create a sample table and inspect PostgreSQL data from your AI app or terminal

Create tables, add sample records and inspect your PostgreSQL data through the Blossom CLI or a connected AI app. Choose Full access for SQL tasks, then select the database inside your instance.

blossom database:list --database_instance database_instance-100

Add Sample Data

Create a test_contacts table with a name and city, add Alex in Seattle and Jamie in Austin, then show me the rows.

The agent submits one transaction. Save sql.yml:

sql:
  statements:
    - CREATE TABLE public.test_contacts (id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text NOT NULL, city text NOT NULL)
    - INSERT INTO public.test_contacts (name, city) VALUES ('Alex', 'Seattle'), ('Jamie', 'Austin')
blossom database:execute --database database-100 --request_key seed_contacts_001 --data sql.yml --follow
blossom database:query --database database-100 --request_key show_contacts_001 --sql 'SELECT * FROM public.test_contacts ORDER BY id' --follow

Each request key identifies one execution. Reuse it with the same request if your connection drops. --follow waits for results; database:sql:show --id opens a Run later. Results remain available for one hour.

Query Your Data

Show me how many test contacts are in each city.

blossom database:query --database database-100 --request_key contacts_by_city_001 --sql 'SELECT city, count(*) FROM public.test_contacts GROUP BY city' --follow

Queries use read-only transactions. Each request can contain up to 20 statements, run for up to 30 seconds, and return up to 1,000 rows. Use --max_rows and --timeout_seconds to choose limits.

In an AI app, the matching tools are database_query, database_execute and database_sql_show. For a change to existing data, describe the exact change and authorize it before the agent submits yes: true.

What You Get

A populated sample table, query results in your conversation or terminal, and a SQL Run you can inspect by its ID.