diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2020-03-14 14:02:44 +0100 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-03-21 17:03:45 -0400 |
| commit | 9ec75882203b2c01aa1d362f939e21ebcd188e8d (patch) | |
| tree | 343d9e368f12f839c2c737cc05d1f5e7bc615536 /lib/sqlalchemy/testing/suite/test_select.py | |
| parent | 376708f4a4958bf2559c14900c52aa6fc7fd05b3 (diff) | |
| download | sqlalchemy-9ec75882203b2c01aa1d362f939e21ebcd188e8d.tar.gz | |
Deprecate plain string in execute and introduce `exec_driver_sql`
Execution of literal sql string is deprecated in the
:meth:`.Connection.execute` and a warning is raised when used stating
that it will be coerced to :func:`.text` in a future release.
To execute a raw sql string the new connection method
:meth:`.Connection.exec_driver_sql` was added, that will retain the previous
behavior, passing the string to the DBAPI driver unchanged.
Usage of scalar or tuple positional parameters in :meth:`.Connection.execute`
is also deprecated.
Fixes: #4848
Fixes: #5178
Change-Id: I2830181054327996d594f7f0d59c157d477c3aa9
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_select.py')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_select.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index 3b64b0f29..5a7fd28e1 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -175,6 +175,10 @@ class LimitOffsetTest(fixtures.TablesTest): def _assert_result(self, select, result, params=()): eq_(config.db.execute(select, params).fetchall(), result) + def _assert_result_str(self, select, result, params=()): + conn = config.db.connect(close_with_result=True) + eq_(conn.exec_driver_sql(select, params).fetchall(), result) + def test_simple_limit(self): table = self.tables.some_table self._assert_result( @@ -209,7 +213,7 @@ class LimitOffsetTest(fixtures.TablesTest): ) sql = str(sql) - self._assert_result(sql, [(2, 2, 3), (3, 3, 4)]) + self._assert_result_str(sql, [(2, 2, 3), (3, 3, 4)]) @testing.requires.bound_limit_offset def test_bound_limit(self): |
