gbrian opened a new issue #9045: Allow environment variables for sqlalchemy uri
URL: https://github.com/apache/incubator-superset/issues/9045
 
 
   **Is your feature request related to a problem? Please describe.**
   When deploying to multiple environments we'll like to be able to switch 
database connection.
   Currently we have one script fixing database sqlalchemy uri
   
   **Describe the solution you'd like**
   Allow the use of environment variables as the value of `sqlalchemy_uri` 
property of `Database`
   
   **Describe alternatives you've considered**
   No idea
   
   **Additional context**
   We depoy using docker
   
   **Proposal**
   
       class Database(Model, AuditMixinNullable, ImportMixin):
       ....
       allow_env_for_uri = Column(Boolean, default=False)
       ....
       @property
       def expanded_sqlalchemy_uri(self):
           if self.allow_env_for_uri:
               return os.path.expandvars(self.sqlalchemy_uri)
           return self.sqlalchemy_uri
       
       @property
       def sqlalchemy_uri_decrypted(self):
           conn = sqla.engine.url.make_url(self.expanded_sqlalchemy_uri)
           if custom_password_store:
               conn.password = custom_password_store(conn)
           else:
               conn.password = self.password
           return str(conn)
   

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


With regards,
Apache Git Services

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

Reply via email to