-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Update conf column in dag_run table type from bytes to JSON #44533
base: main
Are you sure you want to change the base?
Update conf column in dag_run table type from bytes to JSON #44533
Conversation
While Testing this I noticed an issue in the downgrade case. We are not removing the data from downgrade and just perform below conversion.
I am getting Should we also move data to the archive table in case of a downgrade as well? |
Yeah, it is different than XCom, because XCom code had handling of both JSON & pickle type -- for dagrun conf it would be different. For downgrade you might just want to insert all records from the archive table back here. |
@@ -137,7 +138,7 @@ class DagRun(Base, LoggingMixin): | |||
triggered_by = Column( | |||
Enum(DagRunTriggeredByType, native_enum=False, length=50) | |||
) # Airflow component that triggered the run. | |||
conf = Column(PickleType) | |||
conf = Column(JSON().with_variant(postgresql.JSONB, "postgresql")) |
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.
Do we not need any more handling than these?
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.
Check if the DagRun edit view works in the FAB UI
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 think you might need to change this line:
Lines 131 to 132 in 3c1124e
if item.conf: | |
item.conf = json.loads(item.conf) |
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.
You will also need to add a newsfragment
, something like:
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.
fyi: the following is what I had to do for XComs:
PRs:
…rate_conf_column_as_json
…onomer/airflow into dag_run_migrate_conf_column_as_json
airflow/migrations/versions/0050_3_0_0_remove_pickled_data_from_dagrun_table.py
Outdated
Show resolved
Hide resolved
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
airflow/migrations/versions/0050_3_0_0_remove_pickled_data_from_dagrun_table.py
Outdated
Show resolved
Hide resolved
airflow/migrations/versions/0050_3_0_0_remove_pickled_data_from_dagrun_table.py
Outdated
Show resolved
Hide resolved
airflow/migrations/versions/0050_3_0_0_remove_pickled_data_from_dagrun_table.py
Outdated
Show resolved
Hide resolved
…onomer/airflow into dag_run_migrate_conf_column_as_json
I don't see why the two failing tests are failing - they are really unrelated to the PR - but they are green on canary builds. |
Those tests are run with It definitely comes from #41327 becasue that's where |
This is a very interesting one. It looks like for some reason the compat tests were running the version of tests that were there before #41327 - which it should not - tests should always be taken from main. First time where #45287 might prove to be useful @gopidesupavan ! |
Ah yeah. I think it just needs rebase. |
…rate_conf_column_as_json
@potiuk I have rebased. Test are running now. |
Oh, we had another issue fixed in #45347 - maybe you need to re-base another time, not generating the same again :-( |
Can you rebase AGAIN @vatsrahul1001 :) -> we found and issue with @jscheffl with the new caching scheme - fixed in #45347 that would run "main" version of the tests. So I think that could be the reason |
:D @jscheffl -> same thought |
I think we are uploading some images differently by seeing workflows? |
…rate_conf_column_as_json
We were not uploading them AT ALL |
😱 |
I am sorry @vatsrahul1001 -> you have to rebase AGAIN - the #45347 caused that #45335 was merged as "green" but it had some issues. It' s now reverted so after you rebase .... you should get a clean green state (minus flaky asyncio test we know about but this one needs further investigation and mostly happens in Python 3.12 |
thanks @jedcunningham. @potiuk all test passed now :) |
UFF! Goood.... That was it then :) |
BTW. @vatsrahul1001 I also submitted this apache/infrastructure-actions#88 so that in the futur we can protect against similar mistakes (of mine this time). That was a good learning :) |
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
closes: #43933
^ 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.rst
or{issue_number}.significant.rst
, in newsfragments.