[Grok-dev] megrok.rdb, Oracle, and views.

Martijn Faassen faassen at startifact.com
Sat Feb 13 04:57:06 EST 2010


Hi there,

Jeffrey D Peterson wrote:
[snip]
> In setup.py I simply added a parameter and conditional to the setupDatabase
> function:
> 
> def setupDatabase(metadata, skip_create=False):
>     """Set up of ORM for engine in current site.
> 
>     This will:
> 
>     * reflect any reflected tables that need to be reflected from the
> database
>       into classes.
> 
>     * create any tables in the database that haven't been yet reflected.
>     """
>     reflectTables(metadata)
>     if not skip_create:
>         createTables(metadata)
>     notify(DatabaseSetupEvent(metadata))

Hm, I'd like a way to avoid this boolean flag. As far as I can see you 
need a function that does two things:

* reflect tables

* send the database setup event

What if we just exposed reflectTables in megrok.rdb so you can call that 
directly? I'm trying to recall why DatabaseSetupEvent needs to be sent 
here, but I wonder whether we could move it somewhere else instead.

That just would feel slightly better to me than a boolean that changes 
the behavior.

Regards,

Martijn



More information about the Grok-dev mailing list