Re: Genscripts

Jacob Smullyan <[email protected]> Thu, 3 Nov 2005 11:07:04 -0500
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
On Thu, Nov 03, 2005 at 11:50:32PM +0800, Sinang, Danny wrote:
> Dear All,
>  
> I've just downloaded and untared PyDO 2 beta. Been looking, but can't
> seem to determine where the genscripts are.

That's because there aren't any at the moment.  Writing them wouldn't
be too hard, but no one has done it.  

PyDO2 is able to do a certain amount of introspection at runtime -- it
can get all the tables in a database/schema, and get all the column
and whether they are unique or sequenced (except that we don't have
complete Oracle support for this -- there is a patch that implements
some of it that Someone is going to review someday [hint:)]).  The
"autoschema" function can give you barebones PyDO classes for all the
tables in a schema, or you can define a class with the attribute
"guess_columns" set to True and then skip defining the fields (but you
need an initialized db connection at class definition time for that to
work).

> And also, has anyone here written one for MySQL ?

See above.
  
> If not, how do I go about writing one ?

I'd welcome this.  In fact, you could write a simple genscript that
would work with all the backends, by calling the introspection methods
of the base DBI class.  (However, the api doesn't yet support
introspection into foreign key references; it would be nice if it did,
but I thought that was too much work for me personally to take on for
2.0.)

This reminds me that there are a few outstanding issues I'd like to
address before 2.0 final; I'll send another email about that, because
I could use some help to make it happen.

j

-- 
Jacob Smullyan
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDajWouqamFyFXXLIRAtVAAJ93PFIPOR+6ozl+76LmFdSX6W3zbQCdErTK
8YJDpt2flTNR7Cj/CaM9LfQ=
=Pct4
-----END PGP SIGNATURE-----