model
class MyGPTs(Base):
__tablename__ = "my_gpts"
__table_args__ = {'extend_existing': True} # Add this line
id = Column(Integer, primary_key=True)
bot_identifier = Column(String, nullable=False, default="bot")
unique_id = Column(String, nullable=True, default=str(ObjectId()))
user_id = Column(String, nullable=True)
account_id = Column(String, nullable=False)
project_id = Column(String, nullable=False)
name = Column(String, nullable=True)
app_type = Column(Integer, ForeignKey("app_types.id"))
profile_image = Column(String, nullable=False)
bot_type = Column(String, nullable=True)
bot_ai_engine = Column(Integer, ForeignKey("supported_ai_model.id"))
welcome_messages = Column(ARRAY(String), nullable=True)
suggested_replies = Column(ARRAY(String), nullable=True)
knowledge_base = Column(Integer, nullable=False)
knowledge_sources = Column(ARRAY(JSON), nullable=True)
ui_preferences = Column(JSON, nullable=True)
**status = Column(ARRAY(JSON), nullable=False)**
persona = Column(String, nullable=True)
prompts = Column(String, nullable=True, default=True)
additional_instruction = Column(String, nullable=True)
temperature = Column(Float, default=0.7)
percentage = Column(Float, default=0.0, nullable=True)
created_at = Column(DateTime, default=datetime.now())
is_functions = Column(Boolean, default=False)
functions = Column(ARRAY(Integer), nullable=True)
is_workflows = Column(Boolean, default=False)
workflows = Column(ARRAY(Integer), nullable=True)
query
db_chatbots_data = db.query(MyGPTs).filter(MyGPTs.created_at >= start_date, MyGPTs.created_at <= end_date, MyGPTs.status.any(lambda elem: elem[‘statusText’] == ‘ACTIVE’)).all()
but it is not working, how can I retrieve?
I need to get a query, that is retrieving the data from objects by filtering based on the date range and status.statusText = “ACTIVE”