Hi Michael,
I've sorted this one now :)
I'm sorry for the amigious nature of my post... wasn't clear in my
head at the time.
You are right, I wasn't associating between the two entities in the
example I gave.
I ended up using sqlalchemy.sql._BinaryExpresssion in my subclass,
which enabled the behavior i sought.
I'm using a bleeding edge combination of elixir, tesla and sa, so
won't elaborate more here, otherwise it'd take a while and a
considerable space!
If you're intersted, I can show you how I've achieved geometry support
using elixir and sa via pm or email.

Thanks,
Matt

On Aug 9, 4:44 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> add_entity() by itself is not going to add a table to a count()
> function; the extra entities arent taken into account by count().
> Looking at the query you have below, i.e. the one which "works", im a
> little puzzled.  you aren't associating the geo_route and
> geo_location tables together at all.  so...you actually just want to
> multiply geo_route rows times geo_location rows ?
>
> anyway, to add a FROM clause explicitly, use query.select_from
> (geo_location), and the table will be added to the FROM clause.
>
> On Aug 9, 2007, at 10:23 AM, mattrussell wrote:
>
>
>
> > Hi, related to my recent post on subclassing Column:
>
> > The problem I have is that the right tables are not appearing in the
> > "FROM" list in the query.
> > I have overriden the 'in_' operatror on the column.
>
> > When calling 'all()' on my query instance, I get the result back as I
> > expected, but when calling 'count()'  a table is missing which is used
> > in the where clause:
>
> > This is  an example of a query which works using the 'count()'
> > function on my query object:
>
> > 2007-08-07 19:42:43,082 INFO sqlalchemy.engine.base.Engine.0x..8c
> > SELECT count(geo_route.id)
> > FROM geo_route, geo_location
> > WHERE geo_location.id IN (%(geo_location_id)s, %(geo_location_id_1)s)
>
> > And this is the one produced with my Column subclass overrindg 'in_'
> > in place.
> > Whether or not it overrides 'in_' or uses a different name ('within'
> > for example) is irrelevent here i think.
> > SELECT count(geo_route.id) \nFROM geo_route \nWHERE geo_location.point
> > && SetSRID('BOX3D(-74.847708 39.884318, -74.823589 39.904667)'::box3d,
> > 4326)" {}
>
> > What am I missing? I assume operators do something to add the correct
> > columns to the FROM list, but I can't see where.  I've added print
> > statements to the SA source to that end, but haven't been able to see
> > it.
>
> > Any help much appriciated.
>
> > Thanks,
> > Matt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to