def process(value): value = super_process(value) # unpickle if isinstance(value, dict) and 'pod_override' in value: pod_override = value['pod_override'] # If pod_override was serialized with Airflow's BaseSerialization, deserialize it if isinstance(pod_override, dict) and pod_override.get(Encoding.TYPE): value['pod_override'] = BaseSerialization()._deserialize(pod_override) return value
def process_result_value(self, value, dialect): from airflow.serialization.serialized_objects import BaseSerialization if value is None: return None # Deserialize from a string first if needed if not self.db_supports_json(): value = json.loads(value) return BaseSerialization._deserialize(value)
def process_bind_param(self, value, dialect): from airflow.serialization.serialized_objects import BaseSerialization if value is None: return None # First, encode it into our custom JSON-targeted dict format value = BaseSerialization._serialize(value) # Then, if the database does not have native JSON support, encode it again as a string if not self.db_supports_json(): value = json.dumps(value) return value
def process(value): if isinstance(value, dict) and 'pod_override' in value: value['pod_override'] = BaseSerialization()._serialize(value['pod_override']) return super_process(value)