> Here is a complete proof of concept using your query, Thanks for this constructive response.
> I hope this helps! The provided implementation details look very promising. > @compiles(CreateTableAs, "postgresql") There are additional constraints to consider. * 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. 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.