Skip to content

Conversation

@betodealmeida
Copy link
Member

This is the backend only part of #5524.

@betodealmeida betodealmeida added enhancement:request Enhancement request submitted by anyone from the community change:backend Requires changing the backend lyft Related to Lyft risk:db-migration PRs that require a DB migration v0.31 labels Feb 6, 2019
Copy link
Contributor

@xtinec xtinec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll cherry-pick this into v0.31 to resolve the everlasting migration problems at Lyft. :)

@codecov-io
Copy link

codecov-io commented Feb 6, 2019

Codecov Report

Merging #6823 into master will increase coverage by 0.09%.
The diff coverage is 66.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6823      +/-   ##
==========================================
+ Coverage   56.16%   56.26%   +0.09%     
==========================================
  Files         527      529       +2     
  Lines       23376    23593     +217     
  Branches     2794     2794              
==========================================
+ Hits        13130    13274     +144     
- Misses       9836     9909      +73     
  Partials      410      410
Impacted Files Coverage Δ
superset/views/__init__.py 100% <100%> (ø) ⬆️
superset/views/tags.py 37.75% <37.75%> (ø)
superset/models/sql_lab.py 94.66% <83.33%> (-0.99%) ⬇️
superset/models/tags.py 90.09% <90.09%> (ø)
superset/models/core.py 83.56% <90.9%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff9506f...e6e74ad. Read the comment docs.

@xtinec xtinec requested a review from mistercrunch February 6, 2019 20:39
@betodealmeida
Copy link
Member Author

betodealmeida commented Feb 6, 2019

@williaster just want to double check with you, since you requested in the other PR to not have any frontend files.

@xtinec
Copy link
Contributor

xtinec commented Feb 6, 2019

Merging as all the comments on the backend changes from the original PR, #5524, have been addressed in this revision.

@xtinec xtinec merged commit 8041b63 into apache:master Feb 6, 2019
xtinec pushed a commit that referenced this pull request Feb 6, 2019
This PR introduces the backend changes for a tagging system for Superset, allowing dashboards, charts and queries to be tagged. It also allows searching for a given tag, and will be the basis for a new landing page (see #5327).

# Implicit tags
Dashboard, chart and (saved) queries have implicit tags related to their owners, types and favorites. For example, all objects owned by the admin have the tag `owner:1`. All charts have the tag `type:chart`. Objects favorited by the admin have the tag `favorited_by:1`.

These tags are automatically added by a migration script, and kept in sync through SQLAlchemy event listeners. They are currently not surfaced to the user, but can be searched for. For example, it's possible to search for `owner:1` in the welcome page to see all objects owned by the admin, or even search for `owner:{{ current_user_id() }}`.

(cherry picked from commit 8041b63)
@michellethomas
Copy link
Contributor

We've been having trouble with this db migration in our sandbox environment. The initial deploy fails (likely due to the db migration timing out), somehow the tag and tagged_objects tables get created but not populated with any data and the alembic_version doesn't upgrade to the latest because of the timeout. So if we try to deploy again it fails because it tries to rerun this migration but the Tag table already exists.

I was assuming that the tables should get added along with the data all on commit at the end, is that not true? Is there a way to optimize this migration? It takes a long time with all of the data we have. cc: @john-bodley @graceguo-supercat

@mistercrunch
Copy link
Member

DDL operations like table creation cannot be part of transactions. commit only apply to DML, not DDL. From my understanding on most DBs, DDL also act as implicit COMMIT for ongoing transactions.

@michellethomas
Copy link
Contributor

@mistercrunch By "DDL operations like table creation cannot be part of transactions" you mean that the table creation should be in a separate migration than transactions like adding or changing data in tables? Does that mean someone needs to move everything added to Tag and TaggedObject out of this migration?

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 First shipped in 0.34.0 labels Feb 28, 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 change:backend Requires changing the backend enhancement:request Enhancement request submitted by anyone from the community lyft Related to Lyft risk:db-migration PRs that require a DB migration v0.31 🚢 0.34.0 First shipped in 0.34.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants