summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorJ. Nick Koston <nick@koston.org>2023-04-24 22:32:17 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2023-04-25 10:20:36 -0400
commit188cb4226ac7b337446689ab3498b4397d0b7d2d (patch)
treebdd19819afc3daf710db47f536c1e2f3d6d9e855 /lib/sqlalchemy/engine
parent32a17e60ba63f0278a754e1ab7e9ebf9460e07c5 (diff)
downloadsqlalchemy-188cb4226ac7b337446689ab3498b4397d0b7d2d.tar.gz
disable "bytes" handler for all drivers other than psycopg2
Improved row processing performance for "binary" datatypes by making the "bytes" handler conditional on a per driver basis. As a result, the "bytes" result handler has been disabled for nearly all drivers other than psycopg2, all of which in modern forms support returning Python "bytes" directly. Pull request courtesy J. Nick Koston. Fixes: #9680 Closes: #9681 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9681 Pull-request-sha: 4f2fd88bd9af54c54438a3b72a2f30384b0f8898 Change-Id: I394bdcbebaab272e63b13cc02f60813b7aa76839
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/default.py2
-rw-r--r--lib/sqlalchemy/engine/interfaces.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index 8992334ee..d60428287 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -157,6 +157,8 @@ class DefaultDialect(Dialect):
supports_native_enum = False
supports_native_boolean = False
supports_native_uuid = False
+ returns_native_bytes = False
+
non_native_boolean_check_constraint = True
supports_simple_order_by_label = True
diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py
index 0216c155d..e4914551c 100644
--- a/lib/sqlalchemy/engine/interfaces.py
+++ b/lib/sqlalchemy/engine/interfaces.py
@@ -1055,6 +1055,14 @@ class Dialect(EventTarget):
"""
+ returns_native_bytes: bool
+ """indicates if Python bytes() objects are returned natively by the
+ driver for SQL "binary" datatypes.
+
+ .. versionadded:: 2.0.11
+
+ """
+
construct_arguments: Optional[
List[Tuple[Type[Union[SchemaItem, ClauseElement]], Mapping[str, Any]]]
] = None