You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromsqlalchemyimportUuid, ColumnUUIDC=Uuid(as_uuid=False)
# Database model, database table inferred from class nameclassUser(UserBase, table=True):
id: uuid.UUID=Field(
sa_column=Column(UUIDC, primary_key=True, default=uuid.uuid4),
)
So, my question is: Is this the right tweak?
Description
I want to use mysql, and also use uuid for the primary key. I have adapted the engine to mysql+pymysql. and started it successfully, but after starting it, accessing the front-end gives me the following error.
backend-1 | File "/app/.venv/lib/python3.10/site-packages/sqlalchemy/sql/sqltypes.py", line 3625, in process
backend-1 | value = value.hex
backend-1 | sqlalchemy.exc.StatementError: (builtins.AttributeError) 'str' object has no attribute 'hex'
backend-1 | [SQL: SELECT user.email AS user_email, user.is_active AS user_is_active, user.is_superuser AS user_is_superuser, user.full_name AS user_full_name, user.id AS user_id, user.hashed_password AS user_hashed_password
backend-1 | FROM user
backend-1 | WHERE user.id = %(pk_1)s]
backend-1 | [parameters: [{'pk_1': 'f80a09a5-c1cc-4054-af2f-b02389bc85e7'}]]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Original:
Modified, modified to work properly:
So, my question is: Is this the right tweak?
Description
I want to use mysql, and also use uuid for the primary key. I have adapted the engine to mysql+pymysql. and started it successfully, but after starting it, accessing the front-end gives me the following error.
Operating System
Linux
Operating System Details
Ubuntu 24.04
Python Version
3.10
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions