Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 6 min read Research mediumAdept

Vibe Coding With AI to Generate Synthetic Data: Part 1

Asking Claude to generate synthetic Postgres seed data directly as SQL INSERT statements from a schema-only dump breaks down quickly: claude-3-5-sonnet lost referential integrity somewhere between 20 and 100 rows, and claude-3-7-sonnet often failed with 'model overloaded' errors. A hybrid approach scaled much further. There the model emits JavaScript objects that use faker.js, and the script converts them into INSERTs, which passed at 3,000 rows before foreign-key errors appeared at 5,000. GPT-4.5 showed the same pattern. The pipeline runs in GitHub Actions for Neon dev/test branches, and the open question is whether better prompting costs less effort than maintaining seed scripts by hand.

Related posts

  • Using an AI Assistant to Script Tools

    Docker mediumAdept

    Instead of feeding large datasets like Pylint violation JSON through an LLM to transform them into SQL INSERT statements, the assistant can be prompted to write a JavaScript program that performs the transformation, then run it through a tool call. The tool is defined in YAML and backed by a minimal Docker container with no network, host filesystem, GPU or shell access, only shared volumes and Node.js. Having the model generate tools this way limits how much data goes into the context window and lets repeated tasks run without going back to the LLM.

  • Web-based AI SQL Playground and connecting to Postgres from the browser

    Neon mediumAdept

    Neon's Postgres AI Playground connects to a Postgres database directly from the browser and uses OpenAI's gpt-3.5-turbo to turn natural-language prompts into SQL. Browsers can't open TCP connections, so the Neon serverless driver tunnels the Postgres wire protocol through a WebSocket-to-TCP proxy. The proxy is open source and can be self-hosted to reach other Postgres providers. A Vercel edge function rate-limits requests with Upstash Redis, injects the user's schema (pulled from information_schema.columns and flattened to a compact text form) into the prompt, and streams the model's response back to the editor.

  • postgres.new: In-browser Postgres with an AI interface

    Supabase mediumAdept

    database.build (formerly postgres.new) runs unlimited Postgres databases entirely in the browser via PGlite, a WASM build of Postgres, paired with GPT-4o that has full autonomy over the disposable database. The LLM imports CSVs, generates Chart.js charts, builds ER diagrams from real DDL, and does in-browser semantic search using pgvector and Transformers.js. SQL errors are fed back to the model so it can self-correct, and embeddings are stored in a meta table and referenced by ID to avoid sending large vectors to the model. PGlite relies on Postgres's single-user mode plus wire protocol support, a /dev/blob virtual device for COPY, and IndexedDB/OPFS persistence. A new TypeScript library, pg-gateway, handles the startup/auth handshake so standard Postgres clients can connect to PGlite deployments.

  • Neon Twin: Automate Partial Data Dumps with Postgres and GitHub Actions

    Neon mediumAdept

    A scheduled GitHub Actions workflow can keep a Neon "Twin" refreshed with a partial copy of a production Postgres database. It installs a pinned Postgres version via apt, dumps the schema with pg_dump, extracts row subsets to CSV with psql \copy, then drops and recreates the target schema and restores it with pg_restore. When subsetting related tables, the selection queries must keep foreign keys intact and the restore must load parent tables first. Partial dumps can also reduce PII exposure by leaving out sensitive tables and columns.

  • How to be AI-fancy

    Neon mediumAdept

    Neon added three LLM-backed features to its SQL editor: natural-language SQL generation, automatic naming of history queries, and one-click error fixing. Generation and fixing send the database schema as context to the LLM. Neon chose inline, context-specific actions over a chat assistant because a useful assistant needs multi-stage context gathering and gives less control over the UX. The implementation lessons are a strategy-pattern interface so providers can be swapped (Claude 3.5 Sonnet on AWS Bedrock was chosen, partly to keep schema data inside AWS without extra user consent), a comparison of cloud-integrated and direct AI providers, and plain HTTP response streaming to the browser via the Fetch API reader instead of WebSockets.

The quest for software engineering knowledge.

Look:
Layout: