ANN: db-metadata module

Poster Content
nk4um Moderator
Posts: 485
May 16, 2008 10:47Great stuff Steve!
Great stuff Steve! This looks really useful and looks like a nice clean implementation.
nk4um User
Posts: 24
May 15, 2008 23:16ANN: db-metadata module
I''d like to announce a simple database metadata module I''ve just posted, which is available under a BSD license at:

  http://github.com/scharris/db-metadata/tree/master

  (there''s a download button in the center-top)


The module handles uri''s like:   
  active:db-metadata
     +schema@myschema
     +views@ffcpl:/etc/include-views
     +fields@y
     +fks@y


Arguments for active:db-metadata
---------------------------------------
   +schema: either a direct schema name (not containing a '':''), or a uri which when sourced should return the
      schema name.  To enter a schema name containing a '':'', use the "data:" scheme, e.g. "data:text/plain,ACCOUNTING".

   +views: whether to include views.
    Valid values are y/yes/n/no/t/true/f/false or else a uri yielding one of these values.

   +tables: whether to include tables, with values as for the views argument.

   +fields: whether to include field metadata within table and view elements. 
    Valid values are as described for the views argument.

   +fks: whether to include metadata describing foreign key links in the schema.
    Valid values are as described for the views argument.



The metadata is returned in the following form:

<database-metadata  schema="..." identifiers-case-sensitivity="...">
    <relations>
      <relation type="..." id="..." name="..." schema="...">
        <field id="..." name="...">
          <type>
            <database-type/>
            <jdbc-type-code/>
            <jdbc-type-text/>
            [<max-chars/>]
            [<precision/>
             <scale/
             <radix/>]
          </type>
          <nullable/>
          [<primary-key-part/>]
        </field>
        ...
      </relation>   
      ...
    </relations>
       
    <foreign-key-links>
      <link>
        <referencing-relation name="..." schema="..."/>
        <referenced-relation name="..." schema="..."/>
        <match fk-field="..." pk-field="..."/>
        ...
      </link>
      ...
    </foreign-key-links>
</database-metadata>


Comments welcome, here or to gmail.com user steveOfAR

Thanks,
Steve