sqlhabit / sql_schema_visualizer

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

[contribution] Beta Script for (Sybase) SAP ASE database #8

Closed bjrne closed 1 year ago

bjrne commented 1 year ago

Hey, nice tool! I only have sql based access to an ASE db, so I was happy to find this very well documented and nice tool to help explore the database. Since it has a different structure to postgres etc I needed a different export script, so I wanted to contribute my version if anybody else needs it. It's maybe a bit too niche to put it into the readme, so I'll leave it here for future readers or at your disposal to add it to the right place. It is mostly based on this SO answer . Unfortunately, the types have ids that don't seem to be unique across the database, so the join from this other SO post gives multiple options. I haven't figured out yet how to identify the correct one, so my script returns just the numeric type value.

SELECT 'public' as table_schema, so.name as table_name, sc.name as column_name, sc.type as data_type, sc.colid as ordinal_position
FROM syscolumns sc
INNER JOIN sysobjects so ON sc.id = so.id
WHERE so.type = 'U'
makaroni4 commented 1 year ago

Hi @bjrne 👋

Thanks a ton for the issue, I've added your query to the README with a link to that issue – I hope it'll help someone to visualize their schema 🚀

https://github.com/sqlhabit/sql_schema_visualizer#sap-ase 🍻