P-dd

P-dd is a PHP library for creating dynamic relational database documentation, in a number of forms, for an arbitrary database.

Sunday, December 31, 2006

P-dd 0.1 finally released

Hi all,

Welcome to the world of P-dd - The PHP Database Documentor.

So what is it?

Put simply, it's a library of PHP classes that allow for the easy generation of documentation from a set of database sources.

Put even more simply, it's yet another open source project...

What is the project aim?

  • To make it easy to dynamically create documentation on the structure of relational database based systems regardless of the number of, flavour and capabilities of those systems or the type of documentation required


How does the architecture of the library allow for that?

The library is split into three main components:

  • The Datasources

  • The Database model

  • The Renderers



The Datasources are those components concerned with the collection of raw data from the actual datasources. For example, and OracleDatasource class exists that is aware of how to interrogate an Oracle database for its structure. An XmlDatasource exists that can interpret an XML document that contains a relational database specification. All datasources conform to the same interface (currently described by the TestDatasource) making them interchangeable.

The Database Model is a class based representation of the Table / Column / Key structures that are ubiquitous within the relational database model. A factory exists that can take any of the datasources and produce a complete database model.

The Renderers are capable of taking a formed Database Model and rendering it in that renderer's chosen form.

The structure is such that it is easy to add new datasources, as long as they support the minimum structure required of the model. It is also simple to produce new renderers, as they require only knowledge of the generic database model, and no knowledge of the sources themselves.

So what's available in this version?


  • A database model that consists of:

    • Tables

    • Columns

    • Primary Keys

    • Foreign Keys



  • The database model can be created from the following sources:

    • Oracle

    • XML File



  • The model can be rendered into the following formats:




There are also lots of other little goodies in there such as datasource independant filters, a datasource caching system that limits the round trips to the database and a plethora of examples showing how components can be used as well as a simple Oracle database viewer application to show off what can be possible with just a small amount of work.

And what's the plan for the future

The idea is that, over time, database sources will be added that will allow for the collection of meta-data from all the major database players (Oracle / MySql / Postgres / etc) and produce documentation in most of the popular forms (HTML / XML / RTF / PDF / etc) including ER diagrams.

It is also recognised that in the future it is desirable to take the library into a more analysis role. For example - inferring foreign keys that are not explicitly stated, either by examining the table structures or the data within those tables. Though that is very much a longer term plan.

OK, so where is it?

The source code can be found on Google Code here: http://code.google.com/p/p-dd/ the current release tag being P-dd-0-1-0
More information of the plans for the project can be found on Backpack here: http://bobalicious.backpackit.com/page/800325

So what now?
Well, I hope that some of you people will pick it up and start providing feedback... please do so. But regardless, this remains a little bit of a vanity project anyway so I'm going to keep going with it and see where it takes me even if no-one uses it. Isn't that the life of most open source projects anyway ;-)


Technorati Tags: , , , , , , , , , , , , ,

Labels: ,

3 Comments:

  • At 4:44 PM, Blogger Unknown said…

    Hi - looks interesting. Is this intended as a way of understanding federated databases and database integration? Or a kind of generalized SchemaSpy?
    Stephen North

     
  • At 12:56 PM, Blogger Rob Baillie said…

    It's inteded to be whatever you need it to be...

    I think the most obvious implementation would be a SchemaSpy-like application, but I think the library can be much more than just that.

    I like the idea of allowing the view on several database schemas at once... retrieving the meta-data from the actual databases and supported by an XML file to show how the databases are linked together.

    Other examples: it could be used to generate static documentation on a database schema to ship with a product (open source or otherwise). Your database build script could launch a small PHP application that automatically generates a 'page per table' set of documentation showing all the current column / foreign key constraints / etc. There's no reason why this shouldn't be a PDF that gets printed and shipped in a box if you really wanted to.

    It could also be used to generate XML file representations of the current state of a database in build which can then be checked into version control with the rest of the application. A viewer applciation can then be written to use that XML file as a datasource allowing yuo to view the previous states of the database design without having to recreate the databases.

    Or to put it all another way:

    The library is about making it easy to get meta-data out of relational databases and then producing different views on that data, including views that can then be re-used by the library.

     
  • At 12:58 PM, Blogger Rob Baillie said…

    Also, Stephen... apologies for the comment moderation and the lack of swift response... my blogger settings were a little screwy ;-)

     

Post a Comment

<< Home