Live data from Hacker News

Free SQL→ER diagram tool, runs in the browser, nothing uploaded

sqltoerdiagram.com

21–30 of 81 posts

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#21
post #17

Could we have the option of straight lines and 90 degree angles? I’ve never really liked the bendy ones. Looks cool, good job!

Thanks and I will add this to my todos!

A few years ago I created a similar layout engine, it was extremely janky when I abandoned it because I first wanted to solve order/placing of the tiles but was unable to figure out a good algorithm for it

Eg your example diagram has an optimal order in which there are no overlapping lines... But it's surprisingly hard to figure that out without doing n^m calculations... And I wanted to use it in a game, so a shitton of tiles.

Dunno where I was going with this, just got reminded of that project after looking at this great implementation.

It also reminded me of the xyflow lib

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#22
post #8

It's a small too nothing great I just figured others might find it useful too. I kept finding myself needing to visualize database schemas, but most tools had the same problems: paywalls, mandatory signups, or sending your SQL to someone else's server. No backend, no accounts, no data leaving your machine. A few implementation details that were fun: * Built on instead of DOM/SVG. Tables are rasterized into cached bit…

> The URL contains the entire schema.

Isn’t that going to be a problem due to the URL length limitations?

> It is RECOMMENDED that all senders and recipients support, at a minimum, URIs with lengths of 8000 octets in protocol elements.

https://www.rfc-editor.org/rfc/rfc9110#section-4.1-5

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#23
post #21
post #17

Earlier quoted context omitted.

Thanks and I will add this to my todos!

A few years ago I created a similar layout engine, it was extremely janky when I abandoned it because I first wanted to solve order/placing of the tiles but was unable to figure out a good algorithm for it Eg your example diagram has an optimal order in which there are no overlapping lines... But it's surprisingly hard to figure that out without doing n^m calculations... And I wanted to use it in a game, so a shitton…

In academia, this is called "planar embedding" and can be computed in O(V) where V is the number of vertices of the graph.

However, there are graphs that do not allow planar embeddings (e.g. K_5 or K_3,3, see https://en.wikipedia.org/wiki/Planar_graph).

In this case, you'll probably want to look into heuristics that produce a low number of crossings and little distortion when new vertices are added.

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#24
post #2

I kept finding myself needing to visualize database schemas, but most tools had the same problems: paywalls, mandatory signups, or sending your SQL to someone else's server. So I ended up building my own. You paste in your CREATE TABLE statements and it generates an interactive ER diagram right in the browser. You can drag tables around, auto arrange the layout, edit table/column names directly on the canvas (it rewr…

Small? Yes, but perfectly formed!

(Only minor tweak one could suggest would be multiple table selection for dragging... but to quote Frasier: "Think about it, Niles. What's the one thing better than an exquisite meal? An exquisite meal, with one tiny flaw we can pick at all night." Niles, raising a glass: "Ah, of course, to impossible standards.")

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#26
post #8

It's a small too nothing great I just figured others might find it useful too. I kept finding myself needing to visualize database schemas, but most tools had the same problems: paywalls, mandatory signups, or sending your SQL to someone else's server. No backend, no accounts, no data leaving your machine. A few implementation details that were fun: * Built on instead of DOM/SVG. Tables are rasterized into cached bit…

> The URL contains the entire schema. Isn’t that going to be a problem due to the URL length limitations? > It is RECOMMENDED that all senders and recipients support, at a minimum, URIs with lengths of 8000 octets in protocol elements. https://www.rfc-editor.org/rfc/rfc9110#section-4.1-5

Probably not that important in practice. Firefox allows 2^20 - 4 and Chrome allows 2100000 characters. Also, 8000 characters already allows for an unreasonable amount of SQL and could be extended even further with compression. And if that should not be enough, the website already supports JSON exports. All in all, this seems like a worthwhile tradeoff for not having to store anything.

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#29
post #25

Such an old problem solved very elegantly. Congrats. Remember the days of MySQL Workbench and how clunky it was.

DBeaver does a good job of this and works with most databases. I would not use MySQL Workbench or PGAAdmin now.

This might be a good implementation but is it not easier to use something that can connect to your database than having to copy and paste chunks of SQL?

Re: Free SQL→ER diagram tool, runs in the browser, nothing uploaded

#30
The tool looks very cool! But IMO you can't get an ER diagram from SQL since entities are fundamentally different from tables. They are certainly very similar, but SQL alone doesn't give you enough information to create an ER diagram.

That's not to say that the tool is useless or that diagrams of this sort are unhelpful. I'll admit I'm being pedantic and others will probably disagree.

Post reply on HN