-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Migrate pickled data & change XCom value type to JSON #44166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
605e0ec to
d26cbc1
Compare
Merged
d26cbc1 to
fe0eb2e
Compare
ashb
reviewed
Nov 19, 2024
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love the migration, but it seems "safe" enough (modulo the comment about hex() call on mysql path, and I can't think of a better approach either)
airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py
Outdated
Show resolved
Hide resolved
airflow/migrations/versions/0049_3_0_0_remove_pickled_data_from_xcom_table.py
Outdated
Show resolved
Hide resolved
fe0eb2e to
e38956e
Compare
ashb
approved these changes
Nov 19, 2024
- Changed `XCom.value` column to JSON for all dbs. - Archived pickled XCom data to `_xcom_archive` and removed it from the `xcom` table. - Removed encoded string in XCom serialization and deserialization logic.
e38956e to
a358146
Compare
Member
Author
|
Static failure is unrelated |
Contributor
|
Thanks for the PR - I LIKE it! Sorry entering too late for review :-( |
kaxil
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 22, 2024
This tables was created to not cause data loss (in apache#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table. - Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`. - Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`. - Add support in `airflow db drop-archived` to drop `_xcom_archive`.
kaxil
added a commit
that referenced
this pull request
Nov 22, 2024
This tables was created to not cause data loss (in #44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table. - Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`. - Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`. - Add support in `airflow db drop-archived` to drop `_xcom_archive`.
kaxil
pushed a commit
that referenced
this pull request
Dec 3, 2024
In [PR](#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](#44533 (comment)). related: #44166
got686-yandex
pushed a commit
to got686-yandex/airflow
that referenced
this pull request
Jan 30, 2025
This tables was created to not cause data loss (in apache#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table. - Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`. - Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`. - Add support in `airflow db drop-archived` to drop `_xcom_archive`.
got686-yandex
pushed a commit
to got686-yandex/airflow
that referenced
this pull request
Jan 30, 2025
In [PR](apache#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](apache#44533 (comment)). related: apache#44166
kosteev
pushed a commit
to GoogleCloudPlatform/composer-airflow
that referenced
this pull request
May 27, 2025
This tables was created to not cause data loss (in apache/airflow#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table. - Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`. - Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`. - Add support in `airflow db drop-archived` to drop `_xcom_archive`. GitOrigin-RevId: d6364992b8a48c907ac119fb21900e47d4adaf3c
kosteev
pushed a commit
to GoogleCloudPlatform/composer-airflow
that referenced
this pull request
May 27, 2025
In [PR](apache/airflow#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](apache/airflow#44533 (comment)). related: apache/airflow#44166 GitOrigin-RevId: 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24
kosteev
pushed a commit
to GoogleCloudPlatform/composer-airflow
that referenced
this pull request
Sep 23, 2025
This tables was created to not cause data loss (in apache/airflow#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table. - Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`. - Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`. - Add support in `airflow db drop-archived` to drop `_xcom_archive`. GitOrigin-RevId: d6364992b8a48c907ac119fb21900e47d4adaf3c
kosteev
pushed a commit
to GoogleCloudPlatform/composer-airflow
that referenced
this pull request
Sep 23, 2025
In [PR](apache/airflow#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](apache/airflow#44533 (comment)). related: apache/airflow#44166 GitOrigin-RevId: 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24
kosteev
pushed a commit
to GoogleCloudPlatform/composer-airflow
that referenced
this pull request
Oct 21, 2025
This tables was created to not cause data loss (in apache/airflow#44166) when upgrading from AF 2 to AF 3 if a user had pickled values in XCom table. - Introduced `ARCHIVED_TABLES_FROM_DB_MIGRATIONS` to track tables created during database migrations, such as `_xcom_archive`. - Added `_xcom_archive` to the db cleanup `config_list` for handling its records based on `timestamp`. - Add support in `airflow db drop-archived` to drop `_xcom_archive`. GitOrigin-RevId: d6364992b8a48c907ac119fb21900e47d4adaf3c
kosteev
pushed a commit
to GoogleCloudPlatform/composer-airflow
that referenced
this pull request
Oct 21, 2025
In [PR](apache/airflow#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](apache/airflow#44533 (comment)). related: apache/airflow#44166 GitOrigin-RevId: 40821bfd5c54f3a39b3ff6e8352a4e3a20323e24
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
airflow3.0:breaking
Candidates for Airflow 3.0 that contain breaking changes
area:db-migrations
PRs with DB migration
kind:documentation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
follow-up of #43905
Changes:
XCom.valuecolumn to JSON for all dbs._xcom_archiveand removed it from thexcomtable.XComObjectStorageBackendto make it compatible for AF 2 & 3^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.