Skip to content

Problem with UUID pks #36

@timomeara

Description

@timomeara

here's a simple example:

class EmailQueryConfig(Base):
    __tablename__ = "email_query_configs"
    id = Column(UUID(as_uuid=True), primary_key=True, index=True, default=uuid.uuid4)
    template_id = Column(String(255))
    query_name = Column(String(255))
    query_text = Column(Text)
    query_type = Column(String(50))
    created_at = Column(DateTime(timezone=False), server_default=func.now())
    updated_at = Column(DateTime(timezone=False), server_default=func.now(), onupdate=func.now())


class EmailQueryConfigBase(BaseModel):
    template_id: str
    query_name: str
    query_text: str
    query_type: str


class EmailQueryConfigUpdate(EmailQueryConfigBase):
    id: UUID


admin.add_view(
    model=EmailQueryConfig,
    create_schema=EmailQueryConfigBase,  # Assuming you have a schema for creating EmailQueryConfig
    update_schema=EmailQueryConfigBase,
    update_internal_schema=EmailQueryConfigUpdate,  # Assuming you have a schema for updating EmailQueryConfig
    allowed_actions={"view", "create", "update", "delete"}  # Example actions
)

when i try to update a record, i get:

{
  "detail": [
    {
      "type": "int_parsing",
      "loc": [
        "path",
        "id"
      ],
      "msg": "Input should be a valid integer, unable to parse string as an integer",
      "input": "93c025d9-5831-413c-9460-edb3a28cc729"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions