I'm not familiar with Turbogears 1.1, unfortunately.

Did you know you can run Genshi, Elixir, and SQLAlchemy with
Turbogears 1.0.4.4?  I do that with good results.  The error you're
getting indicates to me that the database binding hasn't been made
before the tables are being created.

I remember recently to support autoload, I had to add the following to
the head of my model.py file (before Entity sub-classes were defined).

from turbogears.database import bind_meta_data
bind_meta_data()

Obviously, I would think that the 'sql create' command would ensure
that the metadata was bound.  Perhaps there is a bug whereby the wrong
metadata is being bound (and the metadata used by the model is never
bound).  You might try explicitly binding (using the code above) and
see if that works (as a workaround).

Otherwise, I agree with Jonathan; it sounds like a TurboGears 1.1
bug... my next approach would be to try 1.0.4.4 (but admittedly,
that's because I'm more familiar with it).

Also, I should mention that I've used the 'sql create' capability only
minimally.

Good luck.

Jason

On Apr 16, 10:39 am, "Dr.T" <[EMAIL PROTECTED]> wrote:
> Jonathan,
>
> I did originally create the project using tg-admin  quickstart, but
> this did not create the database; to do this it was necessary to use
> "tg-admin sql create."
>
> As the project has developed I have rerun "tg-admin sql create".many
> times to re-create the database after model changes with no problems.
>
> When I upgraded to the latest 0.52  version of Elixir (for the bug fix
> when passing name in constraint_kwargs) this stopped working.
>
> When I go back to Elixir 0.4.0.dev_r209 it works again.
>
> Under 0.52 I have tried the various options :
>
>  - "elixir.options_defaults['autosetup'] =
> True"                                   at the top of my model.py
>  -
> "elixir.setup_all()"
> at the end
>  -
> "turbogears.startup.call_on_startup.append(elixir.setup_all)"
> at the end
>
> as recommended by Jason, none of which seem to make any difference.
>
> If I try manually running elixir.setup_all() followed by
> elixir.create_all()  in "tg-admin shell" I get the following error:
>
> **************************************************************************************************************************************************************
> <class 'sqlalchemy.exceptions.InvalidRequestError'>Traceback (most
> recent call last)
> Y:\trunk\<ipython console> in <module>()
> c:\python25\lib\site-packages\elixir-0.5.2-py2.5.egg\elixir
> \__init__.py in create_all(*args, **kwargs)
>      97     '''Create the necessary tables for all declared
> entities'''
>      98     for md in metadatas:
> ---> 99         md.create_all(*args, **kwargs)
>     100
>     101
> C:\Python25\lib\site-packages\sqlalchemy-0.4.0beta5-py2.5.egg
> \sqlalchemy\schema.py in create_all(self, bind, tables, checkfirst)
>    1204
>    1205         if bind is None:
> -> 1206             bind = self._get_bind(raiseerr=True)
>    1207         bind.create(self, checkfirst=checkfirst,
> tables=tables)
>    1208
> C:\Python25\lib\site-packages\sqlalchemy-0.4.0beta5-py2.5.egg
> \sqlalchemy\schema.py in _get_bind(self, raiseerr)
>    1229         if not self.is_bound():
>    1230             if raiseerr:
> -> 1231                 raise exceptions.InvalidRequestError("This
> SchemaItem is not connected to any Engine or Connection.")
>    1232             else:
>    1233                 return None
> <class 'sqlalchemy.exceptions.InvalidRequestError'>: This SchemaItem
> is not connected to any Engine or Connection.
> **************************************************************************************************************************************************************
>
> Does this shed any further light?
>
> Thanks for your help,
>
> Tim
>
> On Apr 16, 2:18 pm, Jonathan LaCour <[EMAIL PROTECTED]>
> wrote:
>
> > Dr.T wrote:
> > > I'm running 1.1 (1.1b1dev_r3505), because I need to use Oracle as
> > > a back end, which led me to choose SQLAlchemy + Elixir and thought
> > > this and Genshi would ease migration later.
>
> > Did you generate your project using the `quickstart` command
> > provided by TurboGears?  If so, and it generated the database code,
> > this is likely a bug in TurboGears 1.1.  If not, you've probably
> > done something differently than how they expect in order to discover
> > all of the tables they need to create.  You might need to use their
> > metadata, for example.
>
> > Until we know more, we really can't help you out.  Best of luck!
>
> > --
> > Jonathan LaCourhttp://cleverdevil.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