Module has no mapped classes registered under the name '_sa_instance_state'

Viewed 19

I am using FastAPI SQLAlcamy, I made a project and all thing is well , When i am starting to do relations in models i faced alot of problems .The last of it ( Module 'request' has no mapped classes registered under the name '_sa_instance_state' ) .

This is my models files. I will add my files in google drive any one can access it and contact with me : https://drive.google.com/drive/folders/1feB1whFTEkVTP6Emjud16Q1cu_NVw-JT?usp=sharing

from sqlalchemy import Table,Column,ForeignKey
from sqlalchemy.sql.sqltypes import Integer,String,Text,Time
from pydantic import BaseModel
from config.db import Base,engine
from sqlalchemy.orm import relationship


class Request(Base):
    __tablename__ = 'requests'
    id = Column(Integer,primary_key = True,index=True)
    payment_id = Column(Integer,ForeignKey('payments.id'), index=True)
    slot_id = Column(Integer,ForeignKey('slots.id'), index=True)
    status = Column(Integer)
    started_at = Column(Time)


    qrcode = relationship("Qrcode" ,back_populates = 'request_qrcode')
    payment = relationship("Payment" ,back_populates = 'request_payment')
    slot = relationship("Slot",back_populates = 'request_slot')
0 Answers
Related