-
First Check
Commit to Help
Example Code# I have table with primary key as UUID...
class Table(SQLModel, table=True):
__tablename__ = "optimization_postman"
id: uuid.UUID = Field(primary_key=True)
optimization_id: uuid.UUID = Field(foreign_key="optimization.id")
delivery_time: float
vehicle_types: str
quantity: int
# In database I allready have few records...
# And when I want to search one record with specific ID...
with Session(db) as conn:
query = select(Table).where(Table.id == uuid.uuid4())
row = conn.exec(query).one_or_none() I get error...
It looks like that sqlmodel serialize UUID to wrong uniqueidentifier... 5b18ff56545d4d62bccb66391954b13a DescriptionI can't select records by specific UUID value because UUID serialization is wrong. Operating SystemLinux Operating System Detailslinux ubuntu, database: mssql 2017 docker-compose.yaml version: "3.2"
services:
db-posta-poi:
container_name: mssql
image: mcr.microsoft.com/mssql/server:2017-latest
restart: always
environment:
ACCEPT_EULA: Y
MSSQL_SA_PASSWORD: password
ports:
- 1433:1433 SQLModel Version0.0.19 Python Version3.11 Additional Context |
Beta Was this translation helpful? Give feedback.
Answered by
urosjarc
Jun 26, 2024
Replies: 1 comment
-
I have found duplicated discusion: #878 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
urosjarc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have found duplicated discusion: #878