'Graphql get API is not getting updated

I have attached by crud and graphql file. The problem is if i do any mutation using graphql , then the get query fetches data correctly. However if i update my db manually then the updated record is not fetched for the graphql get query. Am i doing the resolver right? I updated many fields through database and it didnt reflect. How ever when i update the db using update mutation it works.

Crud file:-

    def get_all_record_by_filter(self, query: models.Record) -> Any:
        """ Get A Single Company """
        try:
            log.info("retriving all record data")
            data = query.order_by(models.Record.record_id.desc())
            return data

        except SQLAlchemyError as e:
            log.debug(f"failed to retrive Record data with {e}")
            return None

Graphql file:-

class Query(graphene.ObjectType):
 get_all_record_by_filter = graphene.List(Record,
                                               operation_id=graphene.Argument(type=graphene.String,
                                                                             required=False),
                                               buy_id=graphene.Argument(type=graphene.String,
                                                                         required=False),
                                               Owner=graphene.Argument(type=graphene.String,
                                                                       required=False),
                                               Responsibles=graphene.Argument(type=graphene.String,
                                                                              required=False),
                                               informed=graphene.Argument(type=graphene.String,
                                                                          required=False),
                                               Action=graphene.Argument(type=graphene.String,
                                                                        required=False),
                                               documentversion=graphene.Argument(
                                                   type=graphene.String,
                                                   required=False)


 def resolve_get_all_record_by_filter(self, info,
                                           operation_id='', buy_id='', Owner='', Responsibles='',
                                           informed='', Action='', documentversion='',
                                           ):
        """
        Get All Record with pagination and filters
        """
        query = Record.get_query(info=info)  # SQLAlchemy query
        if operation_id:
            query = query.filter(models.Record.operation_id== operation_id)
        if buy_id:
            query = query.filter(models.Record.buy_id== buy_id)
        if Owner:
            query = query.filter(models.Record.Owner == Owner)
        if Responsibles:
            query = query.filter(models.Record.Responsibles.contains(Responsibles))
        if informed:
            query = query.filter(models.Record.informed.contains(informed))
        if Action:
            query = query.filter(models.Record.Action == Action)
        if documentversion:
            query = query.filter(models.Record.documentversion == documentversion)
      return crud_record.get_all_record_by_filter(query=query)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source