summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/asyncpg.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-02-11 04:54:45 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-06-01 11:40:56 -0400
commit349a7c5e0e2aeeac98fad789b0043a4bdfeed837 (patch)
tree20c314304023752e4cd7bc7894f042cc7b9d7064 /lib/sqlalchemy/dialects/postgresql/asyncpg.py
parent4fb6aca6cfc593c64cd7102cd70924d1b7caea05 (diff)
downloadsqlalchemy-349a7c5e0e2aeeac98fad789b0043a4bdfeed837.tar.gz
add backend agnostic UUID datatype
Added new backend-agnostic :class:`_types.Uuid` datatype generalized from the PostgreSQL dialects to now be a core type, as well as migrated :class:`_types.UUID` from the PostgreSQL dialect. Thanks to Trevor Gross for the help on this. also includes: * corrects some missing behaviors in the suite literal fixtures test where row round trips weren't being correctly asserted. * fixes some of the ISO literal date rendering added in 952383f9ee0 for #5052 to truncate datetime strings for date/time datatypes in the same way that drivers typically do for bound parameters; this was not working fully and wasn't caught by the broken test fixture Fixes: #7212 Change-Id: I981ac6d34d278c18281c144430a528764c241b04
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/asyncpg.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
index d320c323c..1ec787e1f 100644
--- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py
+++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
@@ -138,7 +138,6 @@ from .base import PGDialect
from .base import PGExecutionContext
from .base import PGIdentifierPreparer
from .base import REGCLASS
-from .base import UUID
from ... import exc
from ... import pool
from ... import util
@@ -150,12 +149,6 @@ from ...util.concurrency import await_fallback
from ...util.concurrency import await_only
-try:
- from uuid import UUID as _python_UUID # noqa
-except ImportError:
- _python_UUID = None
-
-
class AsyncpgString(sqltypes.String):
render_bind_cast = True
@@ -237,30 +230,6 @@ class AsyncpgJSONPathType(json.JSONPathType):
return process
-class AsyncpgUUID(UUID):
- render_bind_cast = True
-
- def bind_processor(self, dialect):
- if not self.as_uuid and dialect.use_native_uuid:
-
- def process(value):
- if value is not None:
- value = _python_UUID(value)
- return value
-
- return process
-
- def result_processor(self, dialect, coltype):
- if not self.as_uuid and dialect.use_native_uuid:
-
- def process(value):
- if value is not None:
- value = str(value)
- return value
-
- return process
-
-
class AsyncpgNumeric(sqltypes.Numeric):
render_bind_cast = True
@@ -831,8 +800,6 @@ class PGDialect_asyncpg(PGDialect):
statement_compiler = PGCompiler_asyncpg
preparer = PGIdentifierPreparer_asyncpg
- use_native_uuid = True
-
colspecs = util.update_copy(
PGDialect.colspecs,
{
@@ -842,7 +809,6 @@ class PGDialect_asyncpg(PGDialect):
sqltypes.DateTime: AsyncpgDateTime,
sqltypes.Interval: AsyncPgInterval,
INTERVAL: AsyncPgInterval,
- UUID: AsyncpgUUID,
sqltypes.Boolean: AsyncpgBoolean,
sqltypes.Integer: AsyncpgInteger,
sqltypes.BigInteger: AsyncpgBigInteger,