Use Draw.io to generate SQL / DDL scripts? - sql

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)

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.
To SQL preview:

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.

Related

Generating DDL and documentation from ER-diagram

Looking for a way to have 3 artefacts in sync:
SQL DDL for creating schema tables
Diagram presenting tables, columns and relationships
HTML documentation describing tables and columns,
at least column name, data type and comment/remark
Ideally, there should be one master format from which the others can be generated.
Generating diagrams from other formats usually leads to ugly, not-too-friendly results.
So, is there any tool supporting
drawing a schema diagram, allowing me to define comments/remarks on columns
exporting SQL DDL for creating tables in DB
generating HTML documentation. This is optional, if column remarks can be included in DDL (e.g. "column1 integer, -- my remarks"). Converting DDL to HTML is trivial.
My environment is DB2 9.7 LUW.
IBM DataStudio allows you to generate ER diagram from scratch, or by reverse engineering. IT does not have a sync capability, however it has the option to keep track of your changes.
Also, Data Studio can extract DDL from the database and generate DDL from the current objects.
The HTML generation is not included, but it sounds a very nice feature. However, you can use the COMMENT command in order to include your remarks as part of the DDL.
I tried few tools so I decided to share my experience:
MS Visio Professioinal 2010 ; without extensions, you can not export DDL. I tried Forward Engineer Addin, but that lead to very MS SQL specific result. I've heard that some older versions of Visio can export DDL but I couldn't try.
IBM DataStudio ; very exhaustive installation (1250 MB), Eclipse based tool. This did the job but felt like overkill.
MySQL Workbench 6.1.4 CE ; Handy, responsive tool with reasonable footprint (125 MB). With few minutes try, I had drawn an ER-diagram and exported it as DDL and SVG. And the result was good quality.
My choise is MySQL Workbench. It's open source and seems easy to extend with Python. The next step for me is to see if I can extend it to emit HTML documentation of schema.

Generate db diagram from any sql statement

I'm using DBArtisan 8.5.5 and it has the ability to generate Database Diagrams using Build Query, it has a nice feature that lets it autojoin, detecting potential relationships on newly added tables to the diagram. So the diagram results into a SQL statement since its a Query Builder after all.
Is it possible to provide an SQL statement in DBArtisan and generate the Database Diagram? In other words, the reverse (give it the SQL to generate the diagram, instead of using diagrams to generate SQL)?
If no such feature, is there a product out there for Sybase DB that will provide said feature?
DbVis is an actionable choice, being open source and powerful - it's got a good amount of extra features aside from the one you need.
If you're willing to pay, Aqua Data Studio is a very complete and intuitive database IDE.
As a middle ground solution, disposing of both a - constantly updated - open source edition, the DBeaver Open Source IDE, and an Enterprise Edition. Both of these also offer what you need, the main differences as of now being interface, SSH algorithm support and SQL debugging framework offered in Enterprise. You can take a deeper look yourself, comparing the Open Source features with the Enterprise ones.

ORM tool to create SQL tables

I need to create a database in SQLite, but I do not want to create the tables manually.
I already have the model of the data I need in the database, and what kind of relationship is each one (many-many, one-many, ...)
I'm wondering if there is a tool that allows me to do that?
I just need the tool to generate the SQL code. Then I will take care of the queries manually using SQL
I was thinking about placing the model in Django, and see what it generates, but there should be a tool not linked to a particular language that allows me to do that. Am I wrong?
Hibernate have the ability to create a scheme from mapped classes. There is support for SQLite.
You can go for dia (see "Tools that generates something from Dia diagrams" at http://projects.gnome.org/dia/links.html).
Also there is SQL::Translator and DBIx::* that allows reading an schema from YAML, Excel, and other sources, but these are Perl specific.
Good luck
You can use Symfony + Doctrine framework. It can generate SQL queries.
Try this module on CPAN: Parse::Dia::SQL

Which tool to use to export SQL schema from ODBC database?

I have a database in a format which can be accessed via ODBC. I'm looking for a command-line tool to generate SQL file with DROP/CREATE statements from it, preferably with all the information including table/field comments and table relations. (Possibly for a tool to parse the file and import the schema too, but I guess this would be relatively easier to find). Need this to automate workflow, to be able to design the database visually but store it in SVN in code form.
Which tool should I use?
If this helps, the database in question is MS Access, but I guess there's a higher chance of finding a generic ODBC tool...
Okay, I wrote the tool to export access schema/parse SQL files myself, it's available here:
https://bitbucket.org/himselfv/jet-tool
Feel free to use if anyone needs it.
Adding this because I wanted to search an ODBC schema, and came across this post. This tool lets you dump a csv format of the schema itself:
http://sagedataobjects.blogspot.co.uk/2008/05/exploring-sage-data-schema.html
And then you can grep away..
This script may work for you with some modifications. Access (the application) is required though.

Best way to create a DB-tablestructure [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Generating SQL Server DB from XSD
Generating SQL Schema from XML
I have loads and loads of xml files with data, and a schema-file (.xsd) which describes the structure of the xml.
I want to store the data in a MSSQL-database so that I can query it later and display it on a web-site.
I must now create the db-structure, and have so far thought of 3 ways of creating the tables:
Using xmlspy I could load the xsd and use the "create DB from xsd" there. The "trouble" is that I have to manually add the relations between the tables, and also add the columns that is used for these relations.
Using Microsoft SQL Management Studio I could graphically create the tables and relations. The "trouble" here is that the xsd describes about 100 tables and the thought of manually doing this in a GUI way is scary. I would loose track of where I was somewhere in there.
Handwriting the sql in notepad or something. Boring, but then I could do it in small steps, something I could not do with the two other options.
Is there any other way I havent't thought of?
You could do something similar to option (1): import the xsd into a database design tool (e.g. ERwin or PowerDesigner) then do the editing steps in a "graphical" environment, and then have the tool generate the database.
I'm not sure how well these tools work with xml and xsd and you may have to generate the db using xmlspy and then reverse engineer the database. But a good tool will make this easier than "just" with the database.
Hope that this is not too similar to the option (2) you mentioned ...