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? - i use sqlalchemy - those two tables returns none every time i try to query them. - ihave other tables in the sqlite database which working as expected. only those two table behave like so 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. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/95601db3-fcbf-4861-8594-6e3b0fd9b6a1n%40googlegroups.com.