diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-06-13 15:18:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-06-14 11:48:04 -0400 |
| commit | f38f890849700ee1bf719a31275260e2da455bc3 (patch) | |
| tree | e5d8a958d853f05081e57045baa8c9806ad8f27a /test/dialect/postgresql | |
| parent | 7189d0bc82598c2d6dcbb55b054837416db2ee7d (diff) | |
| download | sqlalchemy-f38f890849700ee1bf719a31275260e2da455bc3.tar.gz | |
Deprecate FromClause.count()
count() here is misleading in that it not only
counts from an arbitrary column in the table, it also
does not make accommodations for DISTINCT, JOIN, etc.
as the ORM-level function does. Core should not be
attempting to provide a function like this.
Change-Id: I9916fc51ef744389a92c54660ab08e9695b8afc2
Fixes: #3724
Diffstat (limited to 'test/dialect/postgresql')
| -rw-r--r-- | test/dialect/postgresql/test_query.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/dialect/postgresql/test_query.py b/test/dialect/postgresql/test_query.py index c031e43de..538312a6a 100644 --- a/test/dialect/postgresql/test_query.py +++ b/test/dialect/postgresql/test_query.py @@ -689,28 +689,28 @@ class ServerSideCursorsTest(fixtures.TestBase, AssertsExecutionResults): result = engine.execute(s) assert result.cursor.name + @testing.provide_metadata def test_roundtrip(self): + md = self.metadata + engine = self._fixture(True) - test_table = Table('test_table', MetaData(engine), + test_table = Table('test_table', md, Column('id', Integer, primary_key=True), Column('data', String(50))) test_table.create(checkfirst=True) - try: - test_table.insert().execute(data='data1') - nextid = engine.execute(Sequence('test_table_id_seq')) - test_table.insert().execute(id=nextid, data='data2') - eq_(test_table.select().execute().fetchall(), [(1, 'data1' - ), (2, 'data2')]) - test_table.update().where( - test_table.c.id == 2).values( - data=test_table.c.data + - ' updated').execute() - eq_(test_table.select().execute().fetchall(), - [(1, 'data1'), (2, 'data2 updated')]) - test_table.delete().execute() - eq_(test_table.count().scalar(), 0) - finally: - test_table.drop(checkfirst=True) + test_table.insert().execute(data='data1') + nextid = engine.execute(Sequence('test_table_id_seq')) + test_table.insert().execute(id=nextid, data='data2') + eq_(test_table.select().execute().fetchall(), [(1, 'data1' + ), (2, 'data2')]) + test_table.update().where( + test_table.c.id == 2).values( + data=test_table.c.data + + ' updated').execute() + eq_(test_table.select().execute().fetchall(), + [(1, 'data1'), (2, 'data2 updated')]) + test_table.delete().execute() + eq_(select([func.count('*')]).select_from(test_table).scalar(), 0) class MatchTest(fixtures.TestBase, AssertsCompiledSQL): |
