gamunu commented on issue #19836:
URL: https://github.com/apache/superset/issues/19836#issuecomment-1542694518

   @frafful I finally figured out the issue. The default helm chart uses the 
latest image, which is the dev build. I believe the random changeset gets 
introduced and removed into the dev docker image.
   
   *Note: following these steps may corrupt the database structure, so make a 
database backup before proceeding*
   
   The solution is to use the stable version of the superset docker image in 
the helm chart and then fix the version id in the `alembic_version` table of 
superset database.
   
   1. Add/Update the helm values
   e.g:
   ```yaml
   image:
     repository: apache/superset
     tag: 2.1.0
     pullPolicy: IfNotPresent
   ``` 
   
   I had to jump through a couple of hoops to fix the init job. Initially, 
getting access to the Postgres database.
   
   2. 
   ```
   kubectl port-forward svc/superset-postgresql 5432:5432 -n <namespace>
   ```
   
   With this now, you can use pgsql cli to access the database. Default 
username and password are `superset` and `superset`, I think.
   
   3.
   Next, find the latest migration file version.
   
   ```
   kubectl exec <superset-pod-name> ls superset/migrations/versions
   ```
   
   for me, it was `4ce1d9b25135` - 
`2022-11-28_17-51_4ce1d9b25135_remove_filter_bar_orientation.py`
   
   4. find the current version value in the `alembic_version` using a select 
query and update the version for this file version in the database
   
   ```sql
   UPDATE alembic_version
   SET version_num = '4ce1d9b25135'
   WHERE version_num = '<current version>';
   ```
   
   5. run the superset_init.sh, *this will fail* with an error saying the 
table/column exists in the database. That error message shows the next 
migration version the init is applying. You can copy that version and update 
the version table again. You will have to repeat this until you find the right 
version.
   
   ```
   kubectl exec -it <superset-pod-name> bash
   ```
   
   ```
   bash -c ". pythonpath/superset_init.sh"
   ```
   
   The final version id worked for me is this `f3c2d8ec8595` for v2.1.0,
   
   ```sql
   UPDATE alembic_version
   SET version_num = 'f3c2d8ec8595'
   WHERE version_num = '4ce1d9b25135';
   ```
   


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to