On 5/22/07, AZMel <[EMAIL PROTECTED]> wrote:
>
> Thanks Gaetan, but the same error is thrown.

Ok, sorry, what I said was correct for plain queries, not for
assign_mapper'ed classes (which is what Elixir gives you for the
moment).

See:
http://www.sqlalchemy.org/docs/plugins.html#plugins_assignmapper
for the list of available methods on the entity.

In short you can fix your problem by either using an explicit query
(that's what I'd recommend because then you have access to all the
methods described in the link I gave you yesterday):

records = 
SubDivision.query().join('division').order_by(Division.c.division_id).list()

btw:
- you are mixing badly the syntax for plain SQL queries and ORM queries.
- for that precise query the join is not even needed since you can use
the division_id column of the subdivision table for your order_by.

> > Try:
> > SubDivision.join('division')...
> >
> > Notice the lowercase "j". 'division' is the name of the relation, not
> > the name of the class.
> >
>
> records =
> SubDivision.join('division').select(order_by=Division.c.division_id).execute()
> AttributeError: type object 'SubDivision' has no attribute 'join'
>
>
> It almost seems like I'm missing an import but not sure which one.

They seem fine to me.

> This is the imports from model.py:
>
> from datetime import datetime
> from sqlalchemy import *
> from elixir import *
> from turbogears.database import metadata, session

> from sqlalchemy.ext.assignmapper import assign_mapper

You shouldn't need this last one when using Elixir (unless you mix
plain SQLAlchemy and Elixir).
>

-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to