Extracting an ERD from Force.com using SchemaSpy

PS Winter ’12 has a built in ERD viewer – see e.g. An ERD is Worth a Thousand Words: Schema Builder in Winter ’12 – that may meet some or all of your ERD needs so take a look at that first before considering the approach described below.

I looked around for a data modelling tool for Force.com that can output a complete data model but didn’t find one. (SoqlXplorer for OSX can produce diagrams but is an interactive tool. Other suggestions very welcome.) In the past when working with conventional JDBC databases I have used SchemaSpy. The cool thing about this is that the diagrams are automatically laid out in a rational way, and the accompanying HTML provides extra information and hyper-linking.

The opportunity to use SchemaSpy for Force.com comes from the fact that SchemaSpy primarily uses the java.sql.DatabaseMetaData interface part of the JDBC API which is relatively small and easy to implement. So with the benefit of SchemaSpy being open source to allow inspection and debugging, I went ahead and created a JDBC driver that uses the Force.com enterprise web service (DescribeSObjectResult, Field etc) to implement the parts of the JDBC API that SchemaSpy uses. That allows SchemaSpy to produce its output for a Force.com org.

Here is a small example of the output:

The driver and supporting libraries are available in the Google code project force-metadata-jdbc-driver along with the source code. This project is also linked from the Force.com Code Share project Force Metadata JDBC Driver for SchemaSpy.

Advertisements

5 thoughts on “Extracting an ERD from Force.com using SchemaSpy

  1. How do I install this and how can I connect with my SFDc org to see the ERD. I have 60+ custom object, Can I see ERD for all of them.

  2. Pingback: Export ERD from salesforce.com - Cloud Giga at Cloud Giga

  3. Is there a tool that will import an ERD definition into SFDC, so you have to manualy create objects and entities one at a time ?

    Thanks,
    Deepak.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s