Upgrading pytable's database introspection for postgresql (Code-like output, but egads it's a lot of text...)

One of the features of pytable that's been sitting on the "need to do" list is getting the introspection to the point where one can use the output of the introspection process as editable schemas for further development in legacy applications.

That is to say, I wanted to be able to point the introspection at an existing database (created in whatever legacy mechanism) and get out a database schema that looks approximately like what I would write myself with run-time query-able objects. Decided this was a good first small project for Soni learning Python. She got the basics done yesterday (then succumbed a flu) so I've been extending and revising the code today. I may have broken the MySQL and PySQLite support for the structuring printing along the way, guess we'll see when I care enough to try it on a MySQL database :) .

As of now I can introspect the (large) PostgreSQL billing database and get out a properly resolving schema that has all of the tables and looks reasonably like what I would write by hand. Don't have things like triggers or general constraints extracting yet... don't use a lot of them... probably won't bother just yet, what I have basically meets my needs.

However, the billing database (which is a very old and very large database) winds up as a 15,000 line Python module. It takes on the order of 3 seconds just to load the module and resolve all the cross-references in the schema... way too long for a CGI-based framework. All is not lost; I really only wanted the VoIP sub-schema loaded, and it's a tiny fraction of the total tables in the database.

Other than that, dealt with some database corruption in the MySQL database for MythTV so that I could do a backup (and eventually update the server to MySQL 5.x), updated the workstation's software, did some testing and generally cleaned things up. The headache I've been fighting all day seems to have finally given up, so I'm thinking I may get a bit of paying work done before heading over to Soni's.


Comments are closed.


Pingbacks are closed.