summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/engine/cursor.py17
-rw-r--r--lib/sqlalchemy/testing/plugin/plugin_base.py9
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/cursor.py b/lib/sqlalchemy/engine/cursor.py
index ff9dd0d6a..cf77d0835 100644
--- a/lib/sqlalchemy/engine/cursor.py
+++ b/lib/sqlalchemy/engine/cursor.py
@@ -1201,7 +1201,19 @@ class _NoResultMetaData(ResultMetaData):
self._we_dont_return_rows()
+class _LegacyNoResultMetaData(_NoResultMetaData):
+ @property
+ def keys(self):
+ util.warn_deprecated_20(
+ "Calling the .keys() method on a result set that does not return "
+ "rows is deprecated and will raise ResourceClosedError in "
+ "SQLAlchemy 2.0.",
+ )
+ return []
+
+
_NO_RESULT_METADATA = _NoResultMetaData()
+_LEGACY_NO_RESULT_METADATA = _LegacyNoResultMetaData()
class BaseCursorResult(object):
@@ -1259,7 +1271,7 @@ class BaseCursorResult(object):
self._set_memoized_attribute("_row_getter", make_row)
else:
- self._metadata = _NO_RESULT_METADATA
+ self._metadata = self._no_result_metadata
def _init_metadata(self, context, cursor_description):
@@ -1763,6 +1775,7 @@ class CursorResult(BaseCursorResult, Result):
_cursor_metadata = CursorResultMetaData
_cursor_strategy_cls = CursorFetchStrategy
+ _no_result_metadata = _NO_RESULT_METADATA
def _fetchiter_impl(self):
fetchone = self.cursor_strategy.fetchone
@@ -1838,6 +1851,8 @@ class LegacyCursorResult(CursorResult):
_cursor_metadata = LegacyCursorResultMetaData
_cursor_strategy_cls = CursorFetchStrategy
+ _no_result_metadata = _LEGACY_NO_RESULT_METADATA
+
def close(self):
"""Close this :class:`_engine.LegacyCursorResult`.
diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index 6370d7ce9..492a3224d 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -226,6 +226,15 @@ def setup_options(make_option):
dest="dump_pyannotate",
help="Run pyannotate and dump json info to given file",
)
+ make_option(
+ "--mypy-extra-test-path",
+ type=str,
+ action="append",
+ default=[],
+ dest="mypy_extra_test_paths",
+ help="Additional test directories to add to the mypy tests. "
+ "This is used only when running mypy tests. Multiple OK",
+ )
def configure_follower(follower_ident):