On 6/27/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > Of course the engine must be initialized before any tables can be > > defined or any work done. > > since ive seen people get the wrong idea about this, let me > reiterate: *you can define all your tables and mappers with no > database connection defined whatsoever*,
Not if you're using autoloading or want to be able to switch autoloading on or off for any table without having to modify the rest of the application. To me that's important, especially when you have to start changing the schema of an existing table (adding a field, changing its type, etc), or if the schema is modified externally to the application. > > SAContext initializes the default engine in > > the constructor. Is there a need to push that back to some later > > stage? Which stage? Or can Ian's ideal wrapper simply delay creating > > the 'sac' until it has to? > > easy enough to make "uri" optional in SAContext (the way it is for > everything else in SA) and just allow binding it later via > add_engine() or whatever. SAContext is designed the way it is right > now because Pylons defines the default engine in the .ini file; theres > no need for a "delayed" connection in the usual case. I would probably want this optional URI in a subclass rather than in SAContext itself. The reason 'uri' is a required argument is to guarantee that the default engine is initialized at all times. When we designed SAContext we (Mike & I) agreed that the bound metadata strategy was the most straightforward and adequate for most user apps: the 80/20 rule. Hiding the engine (connectable) as much as possible in the metadata, while still making it accessible when you really need it. Now we're adding one unbound metadata strategy after another. That's fine as log as it doesn't detract from SAContex's primary commitment to its primary userbase. I'd say a mandatory URI and bound metadata is part of its primary commitment for an easy-to-use front end: a normal Python TypeError for "You forgot the 'uri' argument" is about as straightforward as one can get. Or is that changing too? Are you having second thoughts about using bound metadata by default? -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
