0

I was going through SQL Model docs

from typing import Optional

from sqlmodel import Field, SQLModel, create_engine


class Team(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str = Field(index=True)
    headquarters: str

Here, they are doing this name: str = Field(index=True)

With this as a description:

name, the name of the team
We also tell SQLModel to create an index for this column

In SQL how would this look and what is the significance of it?

Link to article: https://sqlmodel.tiangolo.com/tutorial/connect/create-connected-tables/

Alwaysblue
  • 9,948
  • 38
  • 121
  • 210

0 Answers0