Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
BigInteger with fastapi and sqlmodel

I'm using FastAPI with SQLModel which is based on pydantic, SQLAlchemy and type hints. And I'm trying to create a BitInteger (int64 is enough) column. How do I do that?

My sql model declaration looks like that

class ItemBase(sqlmodel.SQLModel):
    name: str
    price: int  


class Item(ItemBase, table=True):
    id: int = sqlmodel.Field(default=None, primary_key=True)


class ItemCreate(ItemBase):
    pass

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

From the issue documenting how to make BigIntegers work with SQLModel:

id: int = Field(default_factory=next_val, sa_column=Column(BigInteger(), primary_key=True, autoincrement=False))

You might need to adjust it slightly for your usage, but using a specific sqlalchemy column type seems to be the way.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!