Dan Romero pfp
Dan Romero
@dwr.eth
What's the best way to get a Postgres database schema into Claude to ask it to write queries?
20 replies
0 recast
37 reactions

Zach pfp
Zach
@zachterrell
oh man
1 reply
0 recast
0 reaction

Toni pfp
Toni
@wager
Use goose + local MCP https://block.github.io/goose/
1 reply
0 recast
4 reactions

Nicholas Charriere pfp
Nicholas Charriere
@pushix
What I do is a _little_ manual but not too bad. 1. Open a psql shell 2. Run \d (list all tables) 3. For each table run \d table_name 4. Copy everything from top to bottom, and feed it into the LLM as context. Will build perfect queries
0 reply
0 recast
2 reactions

Roadu ๐ŸŽฉ๐ŸฆŠ pfp
Roadu ๐ŸŽฉ๐ŸฆŠ
@roadu
maybe give it a link to the schemas github page
0 reply
0 recast
2 reactions

schrรถdinger pfp
schrรถdinger
@schrodinger
database schema exists in superposition until claude observes it - try pg_dump with -s flag for structure only, output as plain text not sql. alternatively \d+ for each table produces human-readable format that collapses nicely into claude's understanding. both methods simultaneously work and fail depending on schema complexity and claude's quantum state when processing
0 reply
0 recast
1 reaction

nick pfp
nick
@nickysap
schema.sql file in your codebase usually does the trick
0 reply
0 recast
1 reaction

JB Rubinovitz โŒโ—จ-โ—จ pfp
JB Rubinovitz โŒโ—จ-โ—จ
@rubinovitz
We are using prisma so we can feed the Postgres schema file into cursor context to do this. If you find your schema file you can @ it into cursor or copy paste it into Claude web.
0 reply
0 recast
1 reaction

mike rainbow (rainbow mike) โ†‘ pfp
mike rainbow (rainbow mike) โ†‘
@mikedemarais.eth
ask chatgpt bro
1 reply
0 recast
15 reactions

Michael Pfister pfp
Michael Pfister
@pfista
Weโ€™re adding postgres and mysql shcema retrieval to Skeet.build very soon
1 reply
0 recast
4 reactions

Jeff Feiwell  pfp
Jeff Feiwell
@hyper
This cast alone is enough to justify bringing watch back
1 reply
0 recast
3 reactions

Rafi pfp
Rafi
@rafi
If you're okay with terminal: $ pg_dump --no-owner --no-comments --schema-only โŠ™ You can use -t to narrow down for specific tables โŠ™ Configure connection data with PG* env vars or pass connection URI as first arg โŠ™ Pipe it to `pbpaste` to store the output in clipboard
0 reply
0 recast
2 reactions

jackjack.base.eth ๐Ÿ›ฐ๏ธ pfp
jackjack.base.eth ๐Ÿ›ฐ๏ธ
@
Check it out this, it is in browser db with ai interface. https://supabase.com/blog/postgres-new
0 reply
0 recast
2 reactions

Stephan pfp
Stephan
@stephancill
use the output of this query as context https://gist.github.com/stephancill/069d00725e14cf4a84574de20e45996b
0 reply
0 recast
1 reaction

rish pfp
rish
@rish
you can always get the latest schema from the database directly by running this query: SELECT table_name, column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = 'public' -- swap with the right schema name on your side ORDER BY table_name, ordinal_position; paste what it gives you into LLM
0 reply
0 recast
1 reaction

agusti pfp
agusti
@bleu.eth
https://www.blazesql.com/postgres-query-generator haven't tried
0 reply
0 recast
0 reaction

Disky.eth ๐ŸŽฉ pfp
Disky.eth ๐ŸŽฉ
@disky.eth
chatGPT helped me for RumourCast
0 reply
0 recast
0 reaction

jj ๐Ÿ›Ÿ pfp
jj ๐Ÿ›Ÿ
@jj
use postgres mcp server we're building one into skeet.build
0 reply
0 recast
0 reaction

Kasra Rahjerdi pfp
Kasra Rahjerdi
@jc4p
\dt or \d
0 reply
0 recast
0 reaction

lightcap pfp
lightcap
@lightcap.eth
Cool thing about using a local MCP is that it can also run the queries for after it discovers the schema on its own.
0 reply
0 recast
0 reaction