Add server default for map_index in Log table#23056
Conversation
|
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
|
I think this needs a change in the migration file as well? |
@uranusjr in the migration file it's nullable which means essentially that the server default is NULL already. So I don't think we need to change anything more but let me know if you think there's something we need to do. |
But the definition in the class also declares nullable (in the sense that Instead of |
So it does something -- namely, it seems to make it so that when it generates an insert, it doesn't include
I just tried this and it doesn't work. I suspect it already gets a None value since it doesn't get set in init. You can test locally on main by taking a fresh db, dropping map_index from log table, and running |
86fc312 to
b4b646d
Compare
b4b646d to
b0326c8
Compare
When logging CLI actions we insert a record into the Log table. But for 2.3 we add column map_index to Log, and if the Log model expects map_index to be there the insert will fail and a warning will be emitted. We can avoid the error and warning by adding a server_default of NULL on map_index in Log. I choose NULL instead of -1 because generally speaking map_index doesn't make sense for Log tables.
b0326c8 to
85f2a24
Compare
This reverts commit 85f2a24.
When logging CLI actions we insert a record into the Log table. But for 2.3 we add column map_index to Log, and if the Log model expects map_index to be there the insert will fail and a warning will be emitted.
We can avoid the error and warning by adding a server_default of NULL on map_index in Log. I choose NULL instead of -1 because generally speaking map_index doesn't make sense for Log tables.