kaxil commented on code in PR #45431: URL: https://github.com/apache/airflow/pull/45431#discussion_r1904196015
########## task_sdk/src/airflow/sdk/execution_time/context.py: ########## @@ -21,19 +21,32 @@ import structlog from airflow.sdk.exceptions import AirflowRuntimeError, ErrorType +from airflow.sdk.types import NOTSET if TYPE_CHECKING: from airflow.sdk.definitions.connection import Connection - from airflow.sdk.execution_time.comms import ConnectionResult + from airflow.sdk.definitions.variable import Variable + from airflow.sdk.execution_time.comms import ConnectionResult, VariableResult -def _convert_connection_result_conn(conn_result: ConnectionResult): +def _convert_connection_result_conn(conn_result: ConnectionResult) -> Connection: from airflow.sdk.definitions.connection import Connection # `by_alias=True` is used to convert the `schema` field to `schema_` in the Connection model return Connection(**conn_result.model_dump(exclude={"type"}, by_alias=True)) +def _convert_variable_result_to_variable(var_result: VariableResult, deserialize_json: bool) -> Variable: + from airflow.sdk.definitions.variable import Variable + + if deserialize_json: + from json import loads + + var_result.value = loads(var_result.value) # type: ignore + # `by_alias=True` is used to convert the `schema` field to `schema_` in the Variable model + return Variable(**var_result.model_dump(exclude={"type"}, by_alias=True)) Review Comment: We don't have `schema` key in Variable -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org