Project Description

SchemaSpy is a great utility for developing database documentation. This project is to create a custom NAnt task for SchemaSpy to provide an option for automated database documentation.


SchemaSpy is a database documentation tool created by John Currier. It is a tool that evaluates the meta data of a database and then generates HTML documentation on such including relational diagrams. In addition, the documentation also can reveal anomalies with the tables that are analyzed.

For more information on SchemaSpy, please feel free to check out the following:

The goal for the custom NAnt task created in this project is to remove the need to type in the command line information that SchemaSpy requires to generate it's documentation. Though the use of typical NAnt build file syntax, a person can add the documentation through their automated build script without having to use the <exec> task.

Prerequisites To Run SchemaSpy (in general)

While adding the task to your build script requires no prerequisites that NAnt doesn't already use (other than SchemaSpy itself), SchemaSpy does have a few prerequisites as noted on the links above. The prerequisites are as follows for your convenience:

Task Syntax Example

    singleSignOn="true" />

Task Attributes

Attribute Name Required SchemaSpy Argument Description
jarPath Y -jar This is the path to the SchemaSpy JAR file.
dbType Y -t This tells SchemaSpy what type of database driver to use.
host Y -host This is the database server name or IP address where the database is located.
port Y -port The port number for connecting to the database.
dbName Y -db The name of the database to document.
schemaName N -s The name of the database schema to document.
allSchemas N -all Tells SchemaSpy to read and document all accessible database schemas.
schemas N -schemas A child element collection of schema names to specify multiple schemas to document.
outputDirectory Y -o The location where SchemaSpy will generate its documentation.
userName N -u The user name to connect to the database.
password N -p The password to connect to the database for the user name.
singleSignOn N -sso Notifies SchemaSpy to use single sign on (or Integrated Authentication) to connect to the database.
description N -desc A user defined string that will be printed on each Schema level documentation page.
connectionProperties N -connprops Additional connection information used to connect to the database.
driverPath N -dp The path to located the database drivers for SchemaSpy to use if not in the default location.
noHtml N -nohtml Informs SchemaSpy to not generate Html documentation and to only perform analysis.
noRowCount N -norows Informs SchemaSpy to not do a record count of each table it documents and analyzes. (Defaults to True)
allowHtmlComments N -ahic Tells SchemaSpy to not encode (or render) Html located in comment and description fields of tables. (Defaults to False)
highQualityImages N -hq Tells SchemaSpy to generate high quality images when graphing the database.
lowQualityImages N -lq Tells SchemaSpy to generate low quality images when graphing the database.
columnRelationshipExclusion N -x A child element collection of column names to specifically exclude from analysis and documentation.
implyForeignKeys N -noimplied Tells SchemaSpy to included implied foreign keys when documenting. (Defaults to True)
includeTables N -i A pattern for matching table names to document and analyze.
metaFile N -meta The path to where the metafile for additional database information is located.


- If singleSignOn is set to false or is excluded, the userName and password attributes are required. Likewise, if the userName or password attributes are excluded, then singleSignOn is required to be true.

- If you are using an instanced installation of a database (i.e. Microsoft Sql Server Express Edition, etc.), the port number will not be 1433. Each instance has an unique port assigned to it. This unique port is what will need to be used to connect to the database. For more information on this, please see the Database Documentation with SchemaSpy link above.

Last edited Jul 31, 2009 at 6:04 PM by JamesEggers, version 16