Skip to content

Commit

Permalink
sqllab: don't hold database deletion because of query reference (apac…
Browse files Browse the repository at this point in the history
…he#1863)

Let people delete the database even if there are sqllab queries
on that database. Instead delete them too.

Fix apache#1848
  • Loading branch information
xrmx authored and mistercrunch committed Dec 19, 2016
1 parent 6732f01 commit 36fad80
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion superset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2591,7 +2591,10 @@ class Query(Model):
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=True)

database = relationship(
'Database', foreign_keys=[database_id], backref='queries')
'Database',
foreign_keys=[database_id],
backref=backref('queries', cascade='all, delete-orphan')
)
user = relationship(
'User',
backref=backref('queries', cascade='all, delete-orphan'),
Expand Down

0 comments on commit 36fad80

Please sign in to comment.