john-bodley opened a new pull request #7114: [schema] Ensuring that the slice 
datasource fields are non-nullable
URL: https://github.com/apache/incubator-superset/pull/7114
 
 
   We've noticed a number of anomalies in our database caused by ill-defined 
forms and/or table schema definitions. This PR resolves a number of issues 
related to the `slices` table including:
   
   - Ensures that the `datasource_id` column is not-NULL.
   - Ensures that the `datasource_name` column is not-NULL.
   - Ensures that the `datasource_type` column is non-NULL. 
   
   Long terms we should look at trying to deprecate the denormalized 
`datasource_name` column which can (and should) be inferred from the 
(`datasource_id`, `datasource_type`) tuple. I believe the reason for its 
existence is mostly legacy however it may be required for importing/exporting 
of slices where one must identify entities by name rather than ID.  
   
   Note this migration _will_ fail if the `slices.datasource_id`, 
`slices.datasource_name`, or `slices.datasource_type` column is NULL. One 
**must** manually fix these records as programmatically trying to remedy these 
invalid records is difficult as it may not be apparent what the corresponding 
datasource should be given the possibly lack of information. The following 
query determines which records are problematic:
   ```
   SELECT 
       * 
   FROM 
       slices
   WHERE 
       datasource_id IS NULL OR 
       datasource_name IS NULL OR 
       datasource_type IS NULL
   ```
   
   Note this PR is gated by 
https://github.com/apache/incubator-superset/pull/5445 and 
https://github.com/apache/incubator-superset/pull/7084 which ensure that empty 
strings associated with form-data wont persist in the database and is necessary 
for ensuring that the relevant entries are non-NULL.
   
   to: @graceguo-supercat @michellethomas @mistercrunch 
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to