Skip to content

Instantly share code, notes, and snippets.

@get-data-
Created May 21, 2019 22:20
Show Gist options
  • Save get-data-/8cef6aa1bbc23070ffeecbca3a023ab4 to your computer and use it in GitHub Desktop.
Save get-data-/8cef6aa1bbc23070ffeecbca3a023ab4 to your computer and use it in GitHub Desktop.
SQLAlchemy Return All Distinct Column Values
Class.query.with_entities(Class.title).distinct()
titles = [r.title for r in session.query(Class.title).distinct()]
source:https://stackoverflow.com/questions/22275412/sqlalchemy-return-all-distinct-column-values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment