Search code examples
xsdentity-relationshiprelational-databasedatabase-agnostic

Standard database neutral XSD to describe a relational database schema


Is anyone aware of a vendor neutral XSD to describe a relational database schema? Our system needs to grab information about the structure of a database:

  • Tables
  • Columns and types
  • Primary and Foreign Keys Constraints
  • Indexes
  • etc

in a vendor independent manner and store it in an XML file for later processing.

Before we do what we typically do and roll our own. I wanted to do some research and see if there was an existing XSD that people are standardizing on for what I assume is not an uncommon requirement for modeling tools and such. I did not find anything on Google that was not database vendor specific. If you know of an existing public standard I would very much appreciate a link.

Thanks in advance,

Terence


Solution

  • This isn't exactly what you're looking for, but the PostgresSQL Wiki has an interesting section on XML exports, that describes how they are supporting SQL and XML together. It displays a section on how a table would be exported as as XML and the XSD that would support it, which looks rather generic. It could serve as a model for you to create your own.

    The Wiki talks about reference to a ISO/IEC 9075-14:2006 standard, that appears to be adopted by a few big vendors as a baseline. I quick browse on the ISO site says that :2006 was updated to 2008. I'm sure you can find a covered spec of this that you don't have to pay for to download.

    The article also points to a SQL/XML standard definition that is a bit outdated, but could serve your needs if you're looking for some basics.