This tool generates a data dictionary and a table relationship diagram from a JSON input that defines your database schema.
You need to query your database's metadata to get the table and column information. Here are example queries for popular databases:
SELECT json_build_object(
'tables', (SELECT json_agg(...) FROM ...),
'relationships', (SELECT json_agg(...) FROM ...)
);
A full query for PostgreSQL is complex. It's often easier to use a script (Python, Node.js) with a database driver to inspect the schema and build the JSON.
-- For tables and columns:
SELECT table_name, column_name, data_type, is_nullable, column_key, extra
FROM information_schema.columns
WHERE table_schema = 'your_database_name';
-- For relationships:
SELECT table_name, referenced_table_name, constraint_name
FROM information_schema.referential_constraints
WHERE constraint_schema = 'your_database_name';
You'll need to run these queries and manually format the results into the required JSON structure below.
The JSON must have a `tables` array and a `relationships` array. Paste the example below into the text box to see how it works.