summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-12-09 11:39:45 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-12-11 15:39:46 -0500
commit4beecfb9040a7c202a8331b170cfd13119ddd7a3 (patch)
treeb2e8b2b3c9a7225a9dc5d5129a5860c7dc70867b /test/sql
parent8e9e473dcb76b57a7f0eaa476481cb66a258ea69 (diff)
downloadsqlalchemy-4beecfb9040a7c202a8331b170cfd13119ddd7a3.tar.gz
Emit deprecation warnings for plain text under Session
Deprecation warnings are emitted under "SQLALCHEMY_WARN_20" mode when passing a plain string to :meth:`_orm.Session.execute`. It was also considered to have DDL string expressions to include this as well, however this leaves us with no backwards-compatible way of handling reflection of elemens, such as an Index() which reflects "postgresql_where='x > 5'", there's no place for a rule that will turn those into text() within the reflection process that would be separate from when the user passes postgresql_where to the Index. Not worth it right now. Fixes: #5754 Change-Id: I8673a79f0e87de0df576b655f39dad0351725ca8
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_roles.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/sql/test_roles.py b/test/sql/test_roles.py
index 8759bbb22..0ef90e89e 100644
--- a/test/sql/test_roles.py
+++ b/test/sql/test_roles.py
@@ -173,11 +173,14 @@ class RoleTest(fixtures.TestBase):
)
def test_statement_text_coercion(self):
- is_true(
- expect(
- roles.CoerceTextStatementRole, "select * from table"
- ).compare(text("select * from table"))
- )
+ with testing.expect_deprecated_20(
+ "Using plain strings to indicate SQL statements"
+ ):
+ is_true(
+ expect(
+ roles.CoerceTextStatementRole, "select * from table"
+ ).compare(text("select * from table"))
+ )
def test_select_statement_no_text_coercion(self):
assert_raises_message(