switch all together to char as postgres is failing
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import uuid
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
from sqlalchemy.dialects.postgresql import UUID as psqlUUID
|
||||
from sqlalchemy.engine.default import DefaultDialect
|
||||
from sqlalchemy.types import CHAR, TypeDecorator
|
||||
|
||||
@ -29,9 +28,6 @@ class UUID(TypeDecorator): # pragma nocover
|
||||
return ret_value
|
||||
|
||||
def load_dialect_impl(self, dialect: DefaultDialect) -> Any:
|
||||
if dialect.name == "postgresql":
|
||||
return dialect.type_descriptor(psqlUUID())
|
||||
else:
|
||||
return dialect.type_descriptor(CHAR(32))
|
||||
|
||||
def process_bind_param(
|
||||
@ -41,9 +37,6 @@ class UUID(TypeDecorator): # pragma nocover
|
||||
return value
|
||||
elif not isinstance(value, uuid.UUID):
|
||||
value = self._cast_to_uuid(value)
|
||||
if dialect.name == "postgresql":
|
||||
return str(value)
|
||||
else:
|
||||
return "%.32x" % value.int
|
||||
|
||||
def process_result_value(
|
||||
@ -51,9 +44,6 @@ class UUID(TypeDecorator): # pragma nocover
|
||||
) -> Optional[uuid.UUID]:
|
||||
if value is None:
|
||||
return value
|
||||
if dialect.name == "postgresql":
|
||||
return uuid.UUID(value)
|
||||
else:
|
||||
if not isinstance(value, uuid.UUID):
|
||||
return uuid.UUID(value)
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user