Generate db diagram from any sql statement - sql

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.

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.

Is it possible to develop a database app in Visual Studio 2010 for Microsoft SQL Server, then use MySQL instead?

The dev tools for SQL in Visual Studio are great.
Is it possible to develop an app for Microsoft SQL Server, and then deploy a MySQL-compatible database instead?
The dev tools for Microsoft SQL Server are really nice (i.e. LINQ support), but a MySQL-compatible column database has better performance for huge datasets.
You would need to use MySql .net connector
http://dev.mysql.com/doc/refman/5.1/en/connector-net.html
With this, you get some of the functionality that you have with SQL server (entity framework, designer, etc) there are still a bunch of things that are not supported, but it's a good start
It's possible, but a number of specifics might tend to prevent a full implementation on SQL Server, particularly with respect to stored procedures.
However, if the intent is to build a scaffolding on VisStudio and finish the development using the MySQL tools, it would work okay. You'll have to learn both SQLs quite thoroughly. The sooner you do that, the less grief there will be in the conversion.
One method for doing this would be to abstract away the database itself. That be done at least a couple of ways; the first way, you could use classes to build the SQL that your application requires, and then just use that; then all that has to happen is that it has to know how to generate the right SQL for the right server. One of the drawbacks of doing it that way, though, is that if you depend on functionality that exists on only one DBMS, you'll have to emulate it in that abstraction layer.
The other method that you could use is to create two versions of your classes that talk to the RDBMS, one for MySQL and one for Microsoft's SQL Server. Use an interface and derive from it in order to do the actual implementation. Of course, you'll want to make sure that the only responsibility of the class is to interact with the database, so if you're doing this for business layer objects, you'll be implementing those sorts of things with two classes: a low-level one for the database API, and a high-level one for actually providing the API that your application is going to consume.
Perhaps not a direct answer to your question, but the dblinq project may be of use to you.
It may be worth a look just to see the MySQL implementations within the project in order to determine what the real differences between SQL Server and MySQL are going to be and how they're going to affect you. The more you can abstract out those differences behind a dependency implementation, the easier it'll be to swap out one implementation for another.
You can write your code for SQL Server and then switch to Devart LinqConnect.
For example, you can create a LINQ to SQL model using Entity Developer (in VS integration mode or in standalone mode), then change the connection to the MySQL-specific one and run Update Database from Model wizard (don't forget to select the Regenerate Storage check box).
As a result, you will obtain a MySQL database, having structure identical to the SQL Server one.

Is there a tool that will show diagrams of my SQL database in real-time?

I've created some diagrams of SQL tables using the "Reverse Engineer" feature of Microsoft Office Visio. I like being able to visualize my relational databases in this manner.
However, what I get is just a static document that I can print, e-mail to colleagues, and click widgets on.
Earlier this year, I saw at a demo that the new version of Visual Studio 2010 has a new feature called the "Architect Explorer", which allows developers to view relationships among .net classes on the fly. It has many features for filtering the data that the developer is interested in.
It would be really awesome if I could visually browse my tables and stored procedures and see what is related to what by primary key, foreign key, and referenced in stored procedures. I realize that I'm talking about two entirely different technologies and it's not a perfect analogy, but is there some similar tool that would allow me to visualize tables in my SQL database?
I have seen RedGate SQL Dependency Tracker do this:
SQL Dependency Tracker allows you to dynamically explore all your database object dependencies, using a range of graphical layouts.
If you're already using Visio, you should be able to refresh your database diagrams after they've been reverse engineered from an existing database.
Check out:
About synchronizing database model diagrams with databases
If you have a database model that you
created from an existing database with
the Reverse Engineer W izard, you can
keep the drawing synch ronized with
the database.
Is that what you're looking for??

Are there any modeling tools that can visually generate jpa or sql queries?

Does anyone know of a tool like PowerArchitect or SquirrelSQL or maybe eclipse plugin that lets you also generate jpa/sql queries?
Imagine you choosing your database, or your entity beans, and the modeling would reverse engineer your database/entity model, so that you could visually just choose the columns you wanted to select, and it would generate jpa or sql queries for you.
For instance choosing A.b and X.y would generate something like this:
select a.b, x.y from A a, X x join ......
Eclipse (more precisely the Data Tools Platform Project) has a SQL Query Builder built-in. Open a SQL Scrapbook, right-click in it and select Edit in SQL Query Builder:
alt text http://img140.imageshack.us/img140/2872/screenshot003xm.png
This will open the SQL Query Builder:
alt text http://img532.imageshack.us/img532/5943/screenshot004c.png
Then add tables, conditions, etc. There is a Webinar showing it in action.
MyEclipse also has a Visual SQL Query Builder. And I'm pretty sure other standalone universal clients support this visual query builder too.
For JPA, I'm not aware of any visual builder in Dali. This has been mentioned in the past but I have no idea of the exact status (I don't use Dali actually). However, this article mentions a Visual JPQL query builder in IBM Rational Application Developer.
It's a fairly heavy-weight and non-free solution that requires significant investment of time to justify itself, but I believe Database Visual Architect from Visual Paradigm will do what you're asking for.
Take a look at the Generate SQL documentation for DB-VA to get a sense of whether it supports the operations and types of queries you're looking for. If you can't fully assess its applicability from the docs, there's a free 30-day trial that might be worth a shot.
For what it's worth, I've used older versions of several of Visual Paradigm's products and they're definitely top-notch even if a little cumbersome at times.

Using MS Team System 2008 Database Edition

I'm wanting to start source controlling our DBs. I've read a lot of questions here and have found that MS Team System 2008 with Database Edition is what I need. So we get it and we are kind of lost really.
We would like in first place, compare the different DBs we have (DEV, STA and PROD) because we had never done any source control on the DBs, they probably have some differences we would like to solve. I've read that MS Team System 2008 DB Edition could do it, but I think we are not finding how to.
Once we had every DB on the same "state", we would like to create some kind of plan to spread changes from local developers DB to some source control (I think putting the Database Project under SVN will do the job). And then have a way to generate the "change script" to propagate the changes to STA, and then to PROD of course. Any ideas of how to do this?
This probably has been already asked, but I guess I'm not finding anything because I'm not using the correct terms to search.
A link to another SO question or to some article describing how to work with MS Team System 2008 Database Edition and SQL Server 2005 projects will be very welcomed.
Thanks to all
Cheers
The answer to your first question is the schema and data comparison features of Visual Studio Team System - Database Developer. You should have a menu item between Build and Test called Data. Under that data menu are options like "Schema Compare" and "Data Compare" - they are fairly intuitive to use.
The next question is how to use the source control on the databases. Source control should be your one source of truth for schema. When you create your database projects and store them in source control, I would suggest having them mirror production initially. Then you can apply changes to the projects and compare the projects to target environments like dev/QA/prod to identify and script out differences that could be moved to those environments.
EDIT:
I would also highly recommend chapter 8 in the book "Professional Team Foundation Server". That chapter covers usage of Team Edition for Database Professionals for the purposes of managing schemas.