sqlhabit / sql_schema_visualizer

SQL schema visualisation built with ReactFlow.
https://sqlhabit.github.io/sql_schema_visualizer/
MIT License
167 stars 33 forks source link

SQLlite support #13

Open loprima-l opened 4 months ago

loprima-l commented 4 months ago

Do you know if there's a way to export the schema from an SQLlite database ? Thank you :3

makaroni4 commented 3 months ago

Hey @loprima-l 👋

I believe there is, yes!

You can see all SQLite tables using sqlite_schema table:

SELECT * FROM sqlite_schema;

Screenshot 2024-06-28 at 13 04 45

You can either scrape the output or at least get all table names and then inspect each table separately using the PRAGMA function:

PRAGMA table_info(users)

Screenshot 2024-06-28 at 13 05 03

@loprima-l are you up for a challenge to write an adapter? 😊

You'd need to write a script that generates a custom schema CSV file similar to this one: https://github.com/sqlhabit/sql_schema_visualizer/blob/main/schema.csv.template (need to have these columns: "table_schema","table_name","column_name","data_type","ordinal_position")