On Thu, Apr 18, 2019 at 11:50 AM Markus Elfring <markus.elfr...@web.de> wrote:
>

> * I am experimenting with data analysis in an execution environment
>   where I can not use Python decorators so far.
>
> * I would like to perform queries together with the engine 
> “sqlite:///:memory:”
>   (at the moment).
>
>
> > q = (
> >     session.query(
> >         Action.statement1,
> >         Action.statement2,
> >         Action.name,
> >         Action.source_file,
> >         func.count("*").label("C"),
> >     )
> >     .group_by(
> >         Action.statement1, Action.statement2, Action.name, 
> > Action.source_file
> >     )
>
> I wonder about the extra parentheses for this expression.
>
>
> >     .having(func.count("*") > 1)
> > )
> >
> > session.execute(CreateTableAs("t2", q))
>
> I wonder also about the aspect that this suggestion should probably work
> while I stumbled on the code “HAVING count(:count_2) > :count_3”
> in a generated SQL command.
> I would expect the filter “HAVING count(*) > 1” there instead.

there's no technical reason the "1" needs to render inline and
SQLAlchemy defaults literal values to being bound parameters.  If
you'd like it to say "1", then use having(func.count("*") >
literal_column("1")).




>
> I would appreciate further advices for this questionable situation.
>
> Regards,
> Markus

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to