Not recognizing == "column x not in field list". It is there but for some
reason MySQL DBAPI sees a difference between table.column_name and just
column_name. Not sure why.

I got what you said. I will try it here. Thanks!


2014-04-11 15:59 GMT-03:00 Michael Bayer <[email protected]>:

>
> On Apr 11, 2014, at 2:02 PM, Mauricio de Abreu Antunes <
> [email protected]> wrote:
>
>
>
> My consideration here are:
>
> Why is my code translation to "FROM   client_global_counter, (SELECT
> client_glogal_counter2.date" instead of just "FROM  (SELECT
> client_glogal_counter2.date"?
>
>
> OK when you see this pattern,   "FROM x, (SELECT ... FROM .. x)", that means
> you are calling upon columns directly from "x" in some cases and from the
> subquery in others.
>
> You need to make sure that your outermost SELECT always selects things in
> context of the subquery, and not the things that are contained within it.
>
> This can be illustrated with some rudimentary table objects:
>
> from sqlalchemy.sql import select, table, column
>
> t1 = table('t1', column('x'), column('y'))
> s1 = select([t1]).alias()
>
> s2 = select([s1.c.x, s1.c.y])  # correct
>
> s3 = select([t1.c.x, s1.c.y])  # (typically) incorrect
>
> print s2
> # prints:
> # SELECT anon_1.x, anon_1.y
> # FROM (SELECT t1.x AS x, t1.y AS y
> # FROM t1) AS anon_1
>
> print s3
> # prints:
> # SELECT t1.x, anon_1.y
> # FROM t1, (SELECT t1.x AS x, t1.y AS y
> # FROM t1) AS anon_1
>
>
> I didn't dig into your code but hopefully you can see where this is
> happening.
>
>
>
> MySQL is not recognizing some field like client_global_counter.date, hour
> and minute in the first line. Looks like my alias is not doing the right
> thing or I am doing something wrong.
>
>
> define "not recognizing".
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Mauricio de Abreu Antunes*

 Github: https://github.com/mauricioabreu
Twitter: https://twitter.com/maugzoide

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to