kayak / pypika

PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
http://pypika.readthedocs.io/en/latest/
Apache License 2.0
2.49k stars 294 forks source link

Qualifying Statement? #558

Open micah-williamson opened 3 years ago

micah-williamson commented 3 years ago

In snowflake, you can add qualify to a window function similar to how you might use having on a window function.

https://docs.snowflake.com/en/sql-reference/constructs/qualify.html

Pypika does not appear to allow specifying this. Is it possible to add my own statements in addition to "where", "having", etc. I would like to append a qualify statement on a nested query.

micah-williamson commented 3 years ago

I managed to get around this by extending Query => QualifyingQuery and QueryBuilder => QualifyingQueryBuilder. If this is the way to do it i'm fine with that, just wanted to check if there was a better way to do it.