I need to generate query like this:
SELECT **DISTINCT ON** (article.code) article.code, article.title
First I try to make it via ORM distinct method and send it a list with fields. But it wont work. Second, I try to make it via sqlalchemy.sql.select - and it also generate sql query like this:
SELECT DISTINCT article.code, article.title
I Need SELECT **DISTINCT ON** (article.code)
...
I look at source code and found in sqlalchemy.dialects.postgresql.base.PGCompiler.get_select_precolumns
code for generating constructions like: 'DISTINCT ON'
But this method do not called. Instead of this called another method - sqlalchemy.sql.compiler.get_select_precolumns
- it hasn't code for generating DISTINCT ON
only for DISTINCT
Maybe I should configure my session to called properly method?