wulfuric commented on issue #19222:
URL: https://github.com/apache/superset/issues/19222#issuecomment-1255582215

   We are trying to build automation to promote dashboards between environments 
and we're also seeing dashboard import failures. Ours turned out to be due to 
the `expanded_slices` key that the importer couldn't handle, in our case it was 
pointing at a chart no longer part of the dashboard.  No idea how it got there, 
maybe through the ui. Ultimately if we unzipped the dashboards, removed the key 
`yq -i e 'del(.metadata.expanded_slices)' $f` it would import.
   
   This lead to this super hacky snippet in our pipeline, to unzip, remove 
expanded_slices, then reupload.  Ultimately the right fix will be for the 
upload to either ignore or handle the expanded_slices field.
   ```
             cd assets/dashboards
             if [[ ! -f *.zip ]] ; then
               echo 'no dashboards marked for upload'
               exit
             fi
             unzip '*.zip'
             rm -rf *.zip
             # rm -rf ./*/databases
             ls
             yq --help
             yq --version
             for f in ./*/dashboards/*.yaml; do
               yq -i e 'del(.metadata.expanded_slices)' $f
             done
             for f in ./*/; do
                 if [ -d "$f" ]; then
                     # Will not run if no directories are available
                     echo $f
                     zip -r "${f%/}.zip" "$f"
                 fi
   ```
    


-- 
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.

To unsubscribe, e-mail: [email protected]

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