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 #20

Closed
EliAndrewC opened this issue Mar 24, 2014 · 1 comment
Closed

Comments

@EliAndrewC
Copy link
Owner

In our tested version of SQLAlchemy, the 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; we're personally using postgresql everywhere where we'd care, 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.

Now that Sideboard is open source, this is a little more crucial since it introduces a "some of sideboard.lib.sa won't work with MySQL" caveat which we'd probably rather not have.

@EliAndrewC
Copy link
Owner Author

Moved to magfest/sideboard#40

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