Skip to content
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

chore: cleanup sqlalchemy warnings #24403

Merged
merged 2 commits into from
Jun 16, 2023
Merged

Conversation

mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented Jun 14, 2023

As part of a wider hygiene effort to clean up warnings messages and overall noise in our collective dev envrionments and CI, I'm fixing these noisy warnings when using the superset cli

These are warnings that come from the sqlalchemy ORM, probably from a previous bump/upgrade of sqlalchemy

/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'Tag.objects' will copy column tag.id to column tagged_object.tag_id, which conflicts with relationship(s): 'SavedQuery.tags' (copies tag.id to tagged_object.tag_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="tags"' to the 'Tag.objects' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in class_mapper(obj).iterate_properties:
/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'TaggedObject.tag' will copy column tag.id to column tagged_object.tag_id, which conflicts with relationship(s): 'SavedQuery.tags' (copies tag.id to tagged_object.tag_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="tags"' to the 'TaggedObject.tag' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in class_mapper(obj).iterate_properties:
/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'Slice.tags' will copy column slices.id to column tagged_object.object_id, which conflicts with relationship(s): 'SavedQuery.tags' (copies saved_query.id to tagged_object.object_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="tags"' to the 'Slice.tags' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in class_mapper(obj).iterate_properties:
/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'Slice.tags' will copy column tag.id to column tagged_object.tag_id, which conflicts with relationship(s): 'SavedQuery.tags' (copies tag.id to tagged_object.tag_id), 'Tag.objects' (copies tag.id to tagged_object.tag_id), 'TaggedObject.tag' (copies tag.id to tagged_object.tag_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="objects,tag,tags"' to the 'Slice.tags' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in class_mapper(obj).iterate_properties:
/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'SqlaTable.slices' will copy column tables.id to column slices.datasource_id, which conflicts with relationship(s): 'Slice.table' (copies tables.id to slices.datasource_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="table"' to the 'SqlaTable.slices' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in class_mapper(obj).iterate_properties:
/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'Dashboard.tags' will copy column dashboards.id to column tagged_object.object_id, which conflicts with relationship(s): 'SavedQuery.tags' (copies saved_query.id to tagged_object.object_id), 'Slice.tags' (copies slices.id to tagged_object.object_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="tags,tags"' to the 'Dashboard.tags' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)
  for prop in class_mapper(obj).iterate_properties:
/Users/max/.pyenv/versions/3.9.16/envs/superset/lib/python3.9/site-packages/flask_appbuilder/models/sqla/interface.py:67: SAWarning: relationship 'Dashboard.tags' will copy column tag.id to column tagged_object.tag_id, which conflicts with relationship(s): 'SavedQuery.tags' (copies tag.id to tagged_object.tag_id), 'Slice.tags' (copies tag.id to tagged_object.tag_id), 'Tag.objects' (copies tag.id to tagged_object.tag_id), 'TaggedObject.tag' (copies tag.id to tagged_object.tag_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards.   To silence this warning, add the parameter 'overlaps="objects,tag,tags,tags"' to the 'Dashboard.tags' relationship. (Background on this error at: https://sqlalche.me/e/14/qzyx)

@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Merging #24403 (63f63b2) into master (b68de27) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 63f63b2 differs from pull request most recent head 3bc8e0d. Consider uploading reports for the commit 3bc8e0d to get more accurate results

@@           Coverage Diff           @@
##           master   #24403   +/-   ##
=======================================
  Coverage   68.93%   68.93%           
=======================================
  Files        1904     1904           
  Lines       73879    73880    +1     
  Branches     8119     8119           
=======================================
+ Hits        50928    50929    +1     
  Misses      20840    20840           
  Partials     2111     2111           
Flag Coverage Δ
hive 53.94% <100.00%> (+<0.01%) ⬆️
mysql 79.25% <100.00%> (+<0.01%) ⬆️
postgres 79.34% <100.00%> (+<0.01%) ⬆️
presto 53.86% <100.00%> (+<0.01%) ⬆️
python 83.33% <100.00%> (+<0.01%) ⬆️
sqlite 77.84% <100.00%> (+<0.01%) ⬆️
unit 54.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/connectors/base/models.py 87.57% <ø> (ø)
superset/connectors/sqla/models.py 90.37% <ø> (ø)
superset/models/dashboard.py 77.73% <ø> (ø)
superset/models/slice.py 87.62% <ø> (ø)
superset/models/sql_lab.py 79.51% <ø> (ø)
superset/tags/models.py 93.49% <100.00%> (+0.05%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rusackas
Copy link
Member

Looks like some tests are failing. I restarted them just in case we get lucky, but I think they're real and not just flaking.

@mistercrunch
Copy link
Member Author

re-running CI after a re-base, pretty sure I was getting false negatives before...

@mistercrunch mistercrunch merged commit b70808d into apache:master Jun 16, 2023
@mistercrunch mistercrunch deleted the sqlacleanup branch June 16, 2023 22:30
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants