Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crud._distinct_query should work in backends other than postgresql #40

Open
EliAndrewC opened this issue Sep 14, 2016 · 0 comments
Open

Comments

@EliAndrewC
Copy link
Contributor

Moved here from the (now private) original Sideboard issue tracker.

The SQLAlchemy
http://docs.sqlalchemy.org/en/rel_0_8/orm/query.html#sqlalchemy.orm.query.Query.distinct
method only works on specific columns with Postgresql. This means that there's a significant difference between the two forms of distinct that sqlalchemy supports:

>>> [tag.name for tag in session.query(Tag).all()]
[u'Male', u'Male', u'Ninja', u'Pirate']
>>> session.query(Tag).distinct(Tag.name).count()
4
>>> session.query(Tag.name).distinct().count()
3

This is probably fine as long as we document this; I'd generally recommend using postgres everywhere, but it would be nice to not have this restriction. This would require a small but non-trivial rewrite to how we're performing these queries, and we should un-skip the relevant tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant