Just using the SA Table object is a great solution, and one I should
have thought of :)  However, I didn't, so thanks for the thought!
Another question on the topic... does setup_all() detach and then
reattach anything on the mysqldb connection level, or the instances of
all the Entity classes into/out of memory when called a second or
third time, or does it just check to see what's connected already, and
connect anything that's not?

Thanks for the help either way!

On Aug 27, 9:10 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
> On Tue, Aug 26, 2008 at 8:38 PM, baldtrol <[EMAIL PROTECTED]> wrote:
>
> > This may have been answered elsewhere, but I haven't found it...
>
> > When I began a project some time ago, Elixir was on 0.3.  At that
> > time, it was possible to do something like this:
>
> > <code>
> > class MyOuterClass(Entity):
> >    # has_field definitions
> >    # set up some self.external_definitions lookup
> >    def dynamic_table(self, table_name=None):
> >        class TemporaryTable(Entity):
> >               for field_name, field_type in
> > self.external_definitions:
> >                   has_field(field_name, field_type)
> >        return TemporaryTable
>
> > </code>
> > The reason for doing this was that we were regularly loading old
> > VisualFoxPro DBF files into a database, a dozen or more at a time for
> > different clients, and they would update these, and want new ones
> > loaded, etc.  It wouldn't be possible to create new *real* classes in
> > code every time they had a new table to be loaded, so with dbfpy and
> > some wrapper logic, we generated these temporary wrappers.
>
> > In attempting to upgrade to the later versions of Elixir however, it
> > seems like we've run into a problem.  Elixir sets up and establishes
> > all of the Entity hooks on the first run through, and our
> > TemporaryTable class won't connect now.  I'm assuming there has to be
> > a way to make this work though.  I'm at work right now and don't have
> > the code in front of me, but if this isn't making sense, I can send
> > along the full traceback later this evening.  If this is a "known
> > issue" though, or there's an obvious reason why this won't work that
> > I'm missing, that'd be excellent.
>
> The thing is that classes no longer "autosetup" themselves when first
> accessed. You have to explictely setup them. You can use setup_all()
> several times, though. On the other, if your temporary tables only
> include columns, it would make sense to use SQLAlchemy's Table object
> directly.
>
> --
> Gaëtan de Mentenhttp://openhex.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to