there is something wrong with those two sqlite tables: select method returns none but the table already have data.
is that because product class is Primary key and a foreign key at the same time?
for sorry i dont know why is that happening.
or how to fix it
class Product(Base): __tablename__ = 'products' id = Column(Integer, primary_key=True , nullable=False) name = Column(String, nullable=False) price = Column(Float, nullable=False) category = Column(String, nullable=False) description = Column(String, nullable=False) brand = Column(String(200)) is_available = Column(Boolean, nullable=False) stock_count = Column(Integer) ship_range = Column(DateTime) created_at = Column(DateTime) updated_at = Column(DateTime) slug = Column(String, unique=True, nullable=False) orders = relationship('Order', back_populates='product') carts = relationship('Cart', back_populates='product') product_owner = Column(String, ForeignKey('doctors.id')) ProductOwner = relationship('UserDoctor', back_populates='products') def __repr__(self) -> str : return f"({', '.join(f'{k}={v!r}' for k, v in self.__dict__.items() if k != '_sa_instance_state')})" class Cart(Base): __tablename__="carts" id = Column(Integer, primary_key=True, nullable=False) user_id = Column(Integer, ForeignKey('users.id')) user = relationship('User', back_populates='carts') product_id = Column(Integer, ForeignKey('products.id')) product = relationship('Product', back_populates='carts') def __repr__(self): return f"{self.__class__.__name__}({', '.join(f'{k}={v!r}' for k, v in self.__dict__.items() if k != '_sa_instance_state')})"i try the form session.query(User).all() to query data and other forms also but it always returns None although there are data in the table.