[sqlalchemy] Postgres 10 identity keyword

2017-10-08 Thread Seth P
Apologies if I missed something, but does SQLAlchemy (1.2.0?) support the new Postgres 10 identity keyword (https://blog.2ndquadrant.com/postgresql-10-identity-columns/)? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code,

[sqlalchemy] Re: How to use "distinct" in a class based query

2017-10-08 Thread Jonathan Vanasco
FWIW, PostgreSQL supports a "DISTINCT ON" syntax. -- 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

[sqlalchemy] Re: How to use "distinct" in a class based query

2017-10-08 Thread Cornelius Kölbel
OK, after 2 days of trying and searching creating a post in the google groups leads to rephrasing the problem. And this often leads to finding the solution: I managed to do it this way: MyTable.query.with_entities(MyTable.columnB).distinct().all() Problem solved... Am Sonntag, 8. Oktober

[sqlalchemy] How to use "distinct" in a class based query

2017-10-08 Thread Cornelius Kölbel
Hi, I have a table with many columns (columnA, columnB, columnC) and I want to know, how many different entries in columnB are. I would do such an SQL query: select distinct columnB from myTable; I see there is also ``distinct()`` in SQL Alchemy. However - I am using Class defined ORM