Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to fetch a date from mysql workbench according to a certain id (msisdn). But I don't know how to do it with SQLAlchemy with FastApi framework. msisdn is the primary key.

Models:

class PortabilidadInfo(Base):
      __tablename__ = "portabilidad"
      msisdn = Column(Integer, primary_key=True)
      operator_id = Column(Integer, nullable=True)
      last_port = Column(Date, default=datetime.now(), nullable=True)



Code:

Python
portabilidad_msisdn = '56977095634'
         
date_info = session.query(PortabilidadInfo).filter(PortabilidadInfo.last_port, PortabilidadInfo.msisdn == portabilidad_msisdn).first()
print("FECHA BDD OBJ: ", date_info, type(date_info))


what i'm doing wrong?. Please help

What I have tried:

Python
portabilidad_msisdn = '56977095634'
         
date_info = session.query(PortabilidadInfo).filter(PortabilidadInfo.last_port, PortabilidadInfo.msisdn == portabilidad_msisdn).first()
print("FECHA BDD OBJ: ", date_info, type(date_info))
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900