Shkurupii commented on issue #8538:
URL: https://github.com/apache/superset/issues/8538#issuecomment-1121050147

   @andtlopez thanks for the hint.
   
   Same issue. But what I also wanted was to change SECRET_KEY from default one 
to new one. I couldn't find anything about how to decrypt paswords with the 
SECRET_KEY. I found useful to decrypt passwords from working superset before 
upgrade. To do that:
   
   - Run a shell in the app context
   ```
   superset shell
   ```
   - Paste a snippet
   ```
   from sqlalchemy import create_engine
   from sqlalchemy.orm import sessionmaker
   
   from superset import config
   from superset.models.core import Database
   
   engine = create_engine(config.SQLALCHEMY_DATABASE_URI)
   connection = engine.connect()
   Session = sessionmaker(bind=connection)
   session = Session()
   
   db_ids = session.query(Database.id).all()  # -> [(1,), (2,), (3,), (6,), 
(4,), (5,)]
   db_ids = [db_id[0] for db_id in db_ids]  # Flatten
   
   for db_id in db_ids:
       db = session.query(Database).get(db_id)
       if db.password is not None:
           print(db.id, db.database_name, db.password)
   
   session.close_all()
   connection.close()
   engine.dispose()
   ```
   
   Hope it'll help!


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