Skip to content
Discussion options

You must be logged in to vote

Can't reproduce the issue (see details)

import uuid
from datetime import datetime

from sqlmodel import Field, SQLModel, create_engine


class Job(SQLModel, table=True):
    id: str = Field(default_factory=lambda: str(uuid.uuid4()), primary_key=True)
    user_id: str
    created_at: datetime = Field(default_factory=datetime.utcnow)


engine = create_engine(
    "postgresql://user:mysecretpassword@localhost/some_db", echo=True
)
SQLModel.metadata.drop_all(engine)
SQLModel.metadata.create_all(engine)
CREATE TABLE job (
        id VARCHAR NOT NULL, 
        user_id VARCHAR NOT NULL, 
        created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL, 
        PRIMARY KEY (id)
)

To specify server-sid…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
2 participants