-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Set conn_type as not-nullable #9187
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
Conversation
bb43524 to
a40eb35
Compare
a40eb35 to
f03beb4
Compare
| """Apply Set conn_type as non-nullable""" | ||
|
|
||
| with op.batch_alter_table("connection", schema=None) as batch_op: | ||
| batch_op.alter_column("conn_type", existing_type=sa.VARCHAR(length=500), nullable=False) |
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.
Will this work without default value? I'm aware that there should be no connection without type but what if?
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.
If this happens, the migration will fail and the user will have to manually correct the data. The user will receive information on the specific migration, so user will be able to easily determine the source of the problem. I do not want to modify this table because the user may have had different assumptions based on this field. Airflow has always required this field not to be null. Only various hacks of the user could lead to this state, so he will best know the solution to this problem.
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.
Yeah, this sounds good to me -- there's no "sensible default" we could choose to put in this column, so the user will need to manually fix this up.
Yes, agreed. Let's do that in one migration. |
This is a test fixup to #9187, and updates the possibly existing imap_default connection, and adds that hook type to the various lists
This is a test fixup to #9187, and updates the possibly existing imap_default connection, and adds that hook type to the various lists
`conn_type` was enforced by apache#9187
`conn_type` was enforced by #9187
conn_type was enforced by apache#9187
conn_type was enforced by #9187
conn_type was enforced by apache#9187
conn_type was enforced by #9187
The
conn_typecolumn in theconnectiontable must contain content. Previously, this rule was enforced by application logic, but was not enforced by the database schema.Before:
After:
I think we should also set conn_id as non-nullable:
#9067 (comment)
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, 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 UPDATING.md.
Read the Pull Request Guidelines for more information.