SchemaSpy: A tool to generate data model of salesforce org.

Do you want to understand and visualize the schema of a complex salesforce org? Are there hundreds of objects, thousands of fields and many relationships? Native schema builder does provide basic functionality but you want more detailed information? If your answer is yes to any of these questions, then you can use this cool utility — SchemaSpy.

More often than not, enterprise scale projects require to produce documents which can describe the underline database structure either to design a new system, optimize the existing one or for compliance requirements etc. SchemaSpy can make your life easy.

What is SchemaSpy?

SchemaSpy is a Java-based command line tool that analyzes the metadata of a schema in a database and generates ER diagrams. It lets you click through the hierarchy of database tables via child and parent table relationships. SchemaSpy supports many types of databases like Oracle, IBM, MySQL, Microsoft SQL server etc.

SchemaSpy uses the dot executable from Graphviz to generate graphical representations of the table relationships. Now the graphical representation of relationships is a fundamental feature of the tool.


 Folders and files: Below are few of the files you will require for using the tool. Refer download links.

· Apache Ant: 
· Salesforce migration tool:
· Schemaspy files:
· Graphviz:

Below are some of the files that you will need to update to configure the tool. Mostly, configuration is for username, password + security token, connection url etc.


Ensure that, password is appended with security token and connprops (in build.xml) is set to the correct url based on the org production or sandbox.

Execute below command in the terminal.

1. export ANT_HOME=/Users/Salesforce/run-schemaspy/apache-ant-1.9.7

2. export PATH=$PATH:$ANT_HOME/bin

3. echo ‘export PATH=$PATH:/Users/Salesforce/run-schemaspy/apache-ant-1.9.7/bin’ >> ~/.profile

4. echo ‘export CLASSPATH=$CLASSPATH:~> > /Users/Salesforce/run-schemaspy/apache-ant-1.9.7/lib:~/Users/Salesforce/run-schemaspy/’ >> ~/.profile

5. ant
That is it! Now you should have a folder named — doc which includes the result. Open index.html file.


Like what you read? Give Vaibhav Warpe a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.