ofekisr opened a new issue #14482:
URL: https://github.com/apache/superset/issues/14482


   Slice related and depend on it's datasource, it can't live without It. 
   When we take attention to the code inside the Slice model, you can notice 
   ```python
    sqla.event.listen(Slice, "before_insert", set_related_perm)
   
   def set_related_perm(_mapper: Mapper, _connection: Connection, target: 
Slice) -> None:
       src_class = target.cls_model
       id_ = target.datasource_id
       if id_:
           ds = db.session.query(src_class).filter_by(id=int(id_)).first()
           if ds:
               target.perm = ds.perm
               target.schema_perm = ds.schema_perm
   
   @property
   def cls_model(self) -> Type["BaseDatasource"]:
       return ConnectorRegistry.sources[self.datasource_type]
   
   ```
   1. datasource_type is mandatory so it can't be null, it should be enforced 
   2. while deleting datasource, its slices should be deleted too
   
   ### Expected results
   when Inserting new slice without datasource type, exception should be raised 
   while deleting datasource, its slices should be deleted too
   
   (please complete the following information):
   
   - superset version: 0.999.0dev
   - python version: 3.8.6
   - node.js version: `node -v`
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to