load_from_db
Export events from your project database into a CSV for dot plot analytics. Run read-only SELECT queries and shape business tables into user_id, date, and event columns.
Instructions
Pull events out of the project's database into a CSV.
How to use it:
The connection string comes from DOTPLOT_DB_URL by default. Tell the user to export it — never ask them to paste a password into the chat: export DOTPLOT_DB_URL="postgresql://readonly:...@host:5432/db" (Supabase: Dashboard > Settings > Database > Connection string)
Read the schema first (information_schema), find the tables that record what users did, and shape them into user_id, date, event. Most products have no events table — ordinary business tables are the event log: SELECT user_id::text, created_at::date AS date, 'purchase' AS event FROM orders Combine several actions with UNION ALL.
Only SELECT runs; anything else is refused. Recommend a read-only role.
Supports postgresql:// (Supabase, RDS, Neon) and sqlite:///path for testing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| db_url | No | ||
| output_csv | No | events.csv |