From 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24 Mon Sep 17 00:00:00 2001 From: vatsrahul1001 <43964496+vatsrahul1001@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:33:02 +0530 Subject: [PATCH] Fix SQLite condition for detecting pickled data (#44611) In [PR](https://github.com/apache/airflow/pull/44166) we added migration for removing pickled data from `xcom` table. During my testing I noticed with `SQLite` [insert](https://github.com/apache/airflow/blob/main/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py#L88) statement is not working in case of upgrade. Changing condition to `hex(substr(value, 1, 1)) = '80'` works. Tested [here](https://github.com/apache/airflow/pull/44533#discussion_r1867742628). related: https://github.com/apache/airflow/pull/44166 --- .../versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py | 2 +- docs/apache-airflow/img/airflow_erd.sha256 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py b/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py index ed3379ef51b1f..c3972edbd12ab 100644 --- a/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py +++ b/airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py @@ -71,7 +71,7 @@ def upgrade(): condition_templates = { "postgresql": "get_byte(value, 0) = 128", "mysql": "HEX(SUBSTRING(value, 1, 1)) = '80'", - "sqlite": "substr(value, 1, 1) = char(128)", + "sqlite": "hex(substr(value, 1, 1)) = '80'", } condition = condition_templates.get(dialect) diff --git a/docs/apache-airflow/img/airflow_erd.sha256 b/docs/apache-airflow/img/airflow_erd.sha256 index 4987e63b9bbed..f1c65f2e24564 100644 --- a/docs/apache-airflow/img/airflow_erd.sha256 +++ b/docs/apache-airflow/img/airflow_erd.sha256 @@ -1 +1 @@ -b42b04b6cc47650cb9e7a37258a6e8e99bdca2677253715505b8ad287192bf72 \ No newline at end of file +3784bc5f7a8a5d39b5b757e6e07e5026b9c5d4fc978510f435ff64f4c9154f13 \ No newline at end of file