-
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
AssertionError: Dependency rule tried to blank-out primary key column 'ab_permission.id' on instance ' #21407
Comments
i think it should be related to this PR #21296 after I reseted to a commit before that PR. it worked. How to reproduce:
|
Looking. |
Steps I ran:
Then in container I ran:
And that launched Without error. I do see these in the log though
|
thanks for checking @ashb i am not using Did you see
|
If you have M1 then yes. it is super slow (still) but ARM support is coming (it's emulated for now due to dependencies)- but we are closer and closer to get M1 native images. |
@ashb ah, i know how to reproduce it in the local. If i don't do but, if i created a user, it worked fine. |
yes, mine is M1. |
I feel your pain on my new ARM Mac I bought in December :) . I bought it specifically to feel the pain and have more incentive to fix it :) |
@ashb @potiuk looks like lots of PR's CIs are blocked by this error. for example: can you share some insights on how to fix this? (starting webserver without needing to create a user first) or
--- update i saw the user was created https://github.com/apache/airflow/runs/5119349678?check_suite_focus=true#step:7:1491 thanks |
No luck -- doesn't work for me :/ Webserver still launches. This is what I see in the output
|
Yes. I just started to look at it - a lot of docker-compose's is actually failing on that one. We also have a warning generated due to the sqlalchemy 1.4 when we run I think all this compounds to the warnings/errors we have. and |
I guess it is also related to #21167 (comment) @dstandish @blag @ashb ? I have not been too involved in the FAB "extraction" but mybe those issue can be handled at the same time? Seems they are releated. |
Apparently, sync_roles script might lead to leaving orphan rows during syncing the permission model. Since the permission model is only used as "static" model mostly, making sure that there are no orphans left via modifying the cascade method seems to be a good solution - it might lead to deletion and recration of rows so we cannot track/audit changes easily but in case of syncing it seems to be not really needed. Based on discussion in https://stackoverflow.com/questions/23699651/dependency-rule-tried-to-blank-out-primary-key-in-sqlalchemy-when-foreign-key-c Probably Fixes: apache#21407
I looked up where it could come from, and I came up with likely fix to the "blank-out" #21463 - however this is more a "guesswork" based on what I "think" happens. I have not much experience with the Role Model of FAB and relations there, but it seems that the If the https://stackoverflow.com/questions/23699651/dependency-rule-tried-to-blank-out-primary-key-in-sqlalchemy-when-foreign-key-c is right - this might be solved by declaring cascade dependency including "delete-orphan" (however I just try it out it in #21463 without deeper understanding how it works, hoping that it will work, and only now started reading about it to try to understand it - but I think summoning those who possibly understand more about the FAB/Airlfow model inconsistencies and how they are different might actually provide some better fixes (or maybe just fixes - I am not even sure if what I proposed makes sense yet). |
Hmm. Actually I looked at the history, and I think it's nott the SQLAlchemy. U think the root cause was this: #19294 - @jhtimmins @ashb - it was merged 4 days ago and those relationships have been changed into lazy relationships which seems to break |
BTW. My "blind" attempt to fix it, did not work of course. |
@ashb for some unclear reason, removing the primaryjoin argument fixed this problem 73cf882#diff-ca9167167af7221fcb832084b435603b76c7ccdf32dc36d822585853e7c3c98bL143 |
I think the problem was indeed caused by the backref reference blanked out. |
Closing the issue then :) |
Many thanks @jhtimmins ! That was a bummer. |
Apache Airflow version
main (development)
What happened
airflow webserver cannot start due to error
What you expected to happen
airflow webserver cannot start due to error
How to reproduce
Error in CI:
https://github.com/apache/airflow/runs/5101435727?check_suite_focus=true#step:7:2424
Error from my local:
i have the latest airflow main commit:
471e368eacbcae1eedf9b7e1cb4290c385396ea9
python version:
3.9.7
Flask related pkg:
database: mysql
mysql version:
the aiflow.cfg and webserver conf are auto generated, i did not change except
sql_alchemy_conn
Operating System
Apple M1 Max, version: 12.2
Versions of Apache Airflow Providers
No response
Deployment
Other
Deployment details
local dev
Anything else
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: