sqlmodel Questions

2

I have the following models/schemas: class UserBase(SQLModel): full_name: str email: EmailStr is_active: bool = True is_superuser: bool = False class UserRead(UserBase): id: uuid.UUID clas...
Cybele asked 21/11, 2021 at 13:5

1

I'm trying to find a way to get SqlModel and Alembic play nice together. My goal is to not have to hand-edit the auto-generated alembic migrations. Here's my model class: class SongBase(SQLModel): ...
Heteroclite asked 7/11, 2021 at 14:17

3

I'm trying to define a JSON column via SQLModel: from typing import Optional from sqlmodel import Field, Session, SQLModel, create_engine, JSON class Hero(SQLModel, table=True): id: Optional[int...
Jone asked 3/1, 2022 at 15:24

4

Solved

I am trying to get the number of rows matched in a one to many relationship. When I try parent.children_count I get : sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call...
Cotidal asked 30/10, 2022 at 11:46

2

I searched for this error a lot, but I only find some with more information behind that like "FATAL: ...". Mine has none. It only says sqlalchemy.exc.OperationalError: (psycopg2.Operation...
Concur asked 14/2, 2022 at 18:23

2

In my Python FastAPI app, I need Pydantic version 2 to solve an issue with Unions that is fixed in version 2 only. Since FastAPI version 0.100.0 and onward supports Pydantic v2, I was first hopeful...
Systematic asked 29/9, 2023 at 22:9

5

Solved

When working with modular imports with FastAPI and SQLModel, I am getting the following error if I open /docs: TypeError: issubclass() arg 1 must be a class Python 3.10.6 pydantic 1.10.2 fastapi...
Viper asked 7/11, 2022 at 12:24

2

Solved

I was trying to use fastapi users package to quickly Add a registration and authentication system to my FastAPI project which uses the PostgreSQL database. I am using asyncio to be able to create a...
Griskin asked 13/1, 2022 at 10:10

1

class Hero(SQLModel, table=True): id: int = Field(primary_key=True) name: str age: int = Field(default=None) status:str I created the table using SQLModel.metadata.create_all(engine), when I c...
Payee asked 31/8, 2021 at 16:58

1

I'm experimenting with SQLModel (https://sqlmodel.tiangolo.com/) and I get to the point that I had to create a composite index between several fields and I can't how to do it using SQLModel library...
Expressly asked 2/2, 2022 at 15:48

1

Solved

With SQLAlchemy it is possible to create a constraint on two or more columns using the UniqueConstraint declaration. What would be the most idiomatic way of doing that using SQLModel? For example: ...
Peipeiffer asked 8/9, 2022 at 17:23

1

Solved

I want to define a model that has a self-referential (or recursive) foreign key using SQLModel. (This relationship pattern is also sometimes referred to as an adjacency list.) The pure SQLAlchemy i...
Fiddlestick asked 19/8, 2022 at 16:59

0

Does anyone know if its possible to get a INSERT OR IGNORE function with SQLModel? And if not, does anyone know if there is a workaround to get the same results? I haven't tried anything to get the...
Plugboard asked 29/3, 2022 at 5:7

2

Solved

Using SQLModel how to get alembic to recognise the below model? from sqlmodel import Field, SQLModel class Hero(SQLModel, table=True): id: int = Field(default=None, primary_key=True) name: str ...
Corvette asked 26/8, 2021 at 3:21

1

Solved

After working through the tutorial of SQLModel, I don't remember seeing anything on how to implement 1:1 relationships using Relationship attributes. I found documentation for SQLAlchemy, but it's ...
Ralston asked 18/1, 2022 at 16:33

2

Solved

I'm using FastAPI & SQLModel to insert data into SQLite database (I'm posting a few fields, then SQLModel adds UUID and datetime fields and inserts into db). While posting data to FastAPI, I oc...
Fairminded asked 10/12, 2021 at 11:17

1

Solved

I'm struggling to get the syntax to create a UUID field when creating a model in my FastAPI application. I'm using SQLModel. So basically, my models.py file looks like this: from datetime import da...
Stereochemistry asked 30/11, 2021 at 15:46
1

© 2022 - 2024 — McMap. All rights reserved.