skip to Main Content

How to create table fields using char(N) instead of varchar using sqlmodel in python/postgresql

Defining the class: from sqlmodel import Field, SQLModel, create_engine, Session, select, Column,String class person(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str = Field(max_length=100) nickname: str = Field(max_length=30) sqlmodel creates the table person: CREATE TABLE person( id SERIAL NOT NULL,…

VIEW QUESTION
Back To Top
Search