diff --git a/superset/models/core.py b/superset/models/core.py index f61b33a12fccc..f825508ce8e95 100644 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -50,7 +50,8 @@ def set_related_perm(mapper, connection, target): # noqa src_class = target.cls_model id_ = target.datasource_id ds = db.session.query(src_class).filter_by(id=int(id_)).first() - target.perm = ds.perm + if ds: + target.perm = ds.perm class Url(Model, AuditMixinNullable):