Skip to content

Commit

Permalink
intentionally broke SQLAlchemy GUID handling
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-genson committed Dec 27, 2023
1 parent f444b06 commit 5cf5abe
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions mealie/db/models/_model_utils/guid.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,23 @@ def load_dialect_impl(self, dialect):
def process_bind_param(self, value, dialect):
if value is None:
return value
elif dialect.name == "postgresql":
return str(value)
else:
if not isinstance(value, uuid.UUID):
return "%.32x" % uuid.UUID(value).int
else:
# hexstring
return "%.32x" % value.int
return str(value)

# TODO: we probably need this
# elif dialect.name == "postgresql":
# return str(value)
# else:
# if not isinstance(value, uuid.UUID):
# return "%.32x" % uuid.UUID(value).int
# else:
# # hexstring
# return "%.32x" % value.int

def process_result_value(self, value, dialect):
if value is not None and not isinstance(value, uuid.UUID):
value = uuid.UUID(value)
return value

# TODO: we probably need this
# if value is not None and not isinstance(value, uuid.UUID):
# value = uuid.UUID(value)
# return value

0 comments on commit 5cf5abe

Please sign in to comment.