summaryrefslogtreecommitdiff
path: root/test/sql/test_deprecations.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-05-20 13:41:44 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-05-21 14:16:03 -0400
commit4550983e0ce2f35b3585e53894c941c23693e71d (patch)
tree3928e6e333c2b9bb6e23a4de079565a387d309ae /test/sql/test_deprecations.py
parent3d55263c92ee29a0257d823124c353a35246cf31 (diff)
downloadsqlalchemy-4550983e0ce2f35b3585e53894c941c23693e71d.tar.gz
Performance fixes for new result set
A few small mistakes led to huge callcounts. Additionally, the warn-on-get behavior which is attempting to warn for deprecated access in SQLAlchemy 2.0 is very expensive; it's not clear if its feasible to have this warning or to somehow alter how it works. Fixes: #5340 Change-Id: I73bdd2d7b6f1b25cc0222accabd585cf761a5af4
Diffstat (limited to 'test/sql/test_deprecations.py')
-rw-r--r--test/sql/test_deprecations.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py
index 17f9e1579..578743750 100644
--- a/test/sql/test_deprecations.py
+++ b/test/sql/test_deprecations.py
@@ -1119,20 +1119,20 @@ class CursorResultTest(fixtures.TablesTest):
def test_column_accessor_textual_select(self, connection):
users = self.tables.users
- # this will create column() objects inside
- # the select(), these need to match on name anyway
- r = connection.execute(
- select([column("user_id"), column("user_name")])
- .select_from(table("users"))
- .where(text("user_id=2"))
- ).first()
-
with testing.expect_deprecated(
"Retreiving row values using Column objects "
"with only matching names",
"Using non-integer/slice indices on Row is "
"deprecated and will be removed in version 2.0",
):
+ # this will create column() objects inside
+ # the select(), these need to match on name anyway
+ r = connection.execute(
+ select([column("user_id"), column("user_name")])
+ .select_from(table("users"))
+ .where(text("user_id=2"))
+ ).first()
+
eq_(r[users.c.user_id], 2)
r._keymap.pop(users.c.user_id) # reset lookup
@@ -1151,16 +1151,16 @@ class CursorResultTest(fixtures.TablesTest):
def test_column_accessor_basic_text(self, connection):
users = self.tables.users
- r = connection.execute(
- text("select * from users where user_id=2")
- ).first()
-
with testing.expect_deprecated(
"Using non-integer/slice indices on Row is deprecated "
"and will be removed in version 2.0",
"Retreiving row values using Column objects "
"with only matching names",
):
+ r = connection.execute(
+ text("select * from users where user_id=2")
+ ).first()
+
eq_(r[users.c.user_id], 2)
r._keymap.pop(users.c.user_id)
@@ -1344,24 +1344,24 @@ class CursorResultTest(fixtures.TablesTest):
def test_row_getitem_string(self, connection):
col = literal_column("1").label("foo")
- row = connection.execute(select([col])).first()
with testing.expect_deprecated(
"Using non-integer/slice indices on Row is deprecated "
"and will be removed in version 2.0;"
):
+ row = connection.execute(select([col])).first()
eq_(row["foo"], 1)
eq_(row._mapping["foo"], 1)
def test_row_getitem_column(self, connection):
col = literal_column("1").label("foo")
- row = connection.execute(select([col])).first()
with testing.expect_deprecated(
"Using non-integer/slice indices on Row is deprecated "
"and will be removed in version 2.0;"
):
+ row = connection.execute(select([col])).first()
eq_(row[col], 1)
eq_(row._mapping[col], 1)