9

There are a lot of resources on internet about how to import tables into ER diagram on Draw.io using sql script.

For example here (but I find plenty of resources googling):

https://desk.draw.io/support/solutions/articles/16000082007-use-the-sql-plugin-to-create-an-entity-relationship-diagram (SEE PARAGRAPH "Create an ER diagram from SQL code")

I cannot find anything in the reversed direction. Is it possible to create DDL scripts from a ER diagram created through Draw.io?

(plugin? export as xml and import in other tools? anything else...)

I'm dealing with a ER diagram provided by suppliers in Draw.io format. I would like to avoid to handwrite all DDL... (my case is Oracle 12)

Falco
  • 1,458
  • 3
  • 19
  • 47

2 Answers2

8

I’ve got a PR in with a plugin that generates sql, DDL script from erdiagram see: https://github.com/jgraph/drawio/pull/3092. So yes it is now possible, if it gets merged in (or rewritten per their closed contribution guidelines) it will then be possible. You can also install the plugin manually (it’s one file).

Example Usage:

You can find the DLL options under arrange > insert

  • from sql or to sql buttons. drawio_sql_demo

  • To SQL preview: sql export example

lastlink
  • 1,505
  • 2
  • 19
  • 29
2

Reviewing this my old post I'd like to update that I did not find anything.

So the answer is NO. It's not possible to create DDL from design using Draw.IO

Suppliers were told to begin to learn and work free SQL Data Modeler inside Oracle Sql Developer. It's perfect because diagrams generated with this tool can be used to compare diagram generate from db, creating differences and incremental scripts.

Falco
  • 1,458
  • 3
  • 19
  • 47
  • 2
    IIRC draw.io format is a json and it looked quite sane. So maybe there are no existing conversion tools/plugins but it should be possible. I wrote quite a lot DDL-generators in my life so maybe I'll look into it as a task for weekend. – Alex Yu Sep 17 '21 at 12:38
  • @AlexYu, I'd love to hear if you have found anything. I don't want to do an SQL/DDL diagram but still want to show dependencies between structures, very much like table dependencies. I tried https://graphviz.readthedocs.io/en/stable/examples.html#structs-py but the result is far from satisfactory. Thanks! – Jerome Provensal Oct 16 '21 at 00:36
  • No dear, since we are set on Oracle we switched on Oracle SQL Data Modeler (it is free). I suppose any environment has a proprietary solution. It would be nice to find universal solution, but I think it's difficult because of differents sql implementation between various dbms... I think Draw IO is good only for very fast and high level analysis or presentations – Falco Oct 18 '21 at 08:18
  • @AlexYu, Any news/initiative or solution you found? I am also really interested in this – ddsultan Jun 15 '22 at 18:47