jfinkels/flask-restless — pull request #314 by glyphobet (2014-05-12 12:38:47+00:00)
Title: use query.selectable instead of query.statement in count helper

This is a better fix for #309.

Using `query.statement` generates a warning about not having labels; while investigating this warning, it seemed like `query.statement` is more for internal SQLAlchemy use, and `query.selectable` was what we should be using. In addition, `selectable` does not raise these warnings, and also does not suffer from the problem with joins that `statement` did, fixed in #309.

This is the warning that was raised, in `tests.test_views.TestAssociationProxy.test_num_results`:

```
/Users/matt/programs/flask-restless/SQLAlchemy-0.9.4-py2.7.egg/sqlalchemy/sql/base.py:490: SAWarning: Column 'id' on table being replaced by Column('id', Integer(), table=, primary_key=True, nullable=False), which has the same key. Consider use_labels for select() statements.
self[column.key] = column
```