Replies: 1 comment 2 replies
-
Want to send me an invite @dkress59? Probably not enough info here to be able to work out exactly what is happening. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i am currently working on my first python project, which is a starlite-based api. the api uses the sqlalchemy plugin to interact with (async) postgres. i started out with bare sqlalchemy+sqlite via python repl, just to get familiar with sqlalchemy in the first place.
i have been using UUIDs as primary keys, generating the UUIDs on the create/POST route handler, using VARCHAR fields (coming from sqlite). now i am having trouble to use postgres' UUID fields and generating the UUIDs by using
Column(UUID, default=uuid.uuid4)
as in this example.when i create a row in a table (e.g. when i create a user), at first everything seems fine; the response to my POST request is the new user. however, if i now run a GET request to the /users route, all i get is an error (where previously i got "[]"):
there also seems to be a problem with validation, if i try to create the same user (where the "username" field is unique), the response i get is:
i am, by the way, having similar issues with DateTime fields, but maybe it's the same thing that I'm doing wrong.
here's how i am using UUID on the model, although i have tried
from uuid import UUID
and i have also triedfrom sqlalchemy import Uuid
:I'll be happy to provide further information and/or to invite someone to the private repo to take a closer look.
Beta Was this translation helpful? Give feedback.
All reactions