How to check if key is in JSON sqlachemy
I am trying to select a segment if: settings dict is not null Has key user_parameters in it And user_parameters (dict) has key user_id in it Code below: user_id = '100952' select([self.db.segments]).where( and_( self.db.segments.c.settings.isnot(None), cast(self.db.segments.c.settings, JSON)["user_parameters"].as_string().contains(f"'{user_id}'"), ) ) Converting JSON…