Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load extensions on db init #5062

Merged
merged 2 commits into from
Jul 23, 2020
Merged

Load extensions on db init #5062

merged 2 commits into from
Jul 23, 2020

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Jul 23, 2020

What type of PR is this? (check all applicable)

  • Feature

Description

Following #5008, it might be best to allow any custom database extensions to load before creating the database. This PR allows specifying these extensions using the dynamic settings module.

Also, it will only try to create tables and stamp the DB if the tables exist already.

Related Tickets & Documents

#5008

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

@rauchy rauchy requested a review from arikfr July 23, 2020 07:32
def load_extensions(db):
with db.engine.connect() as connection:
for extension in settings.dynamic_settings.database_extensions:
connection.execute(f'CREATE EXTENSION IF NOT EXISTS "{extension}";')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f"yeah"

@rauchy rauchy merged commit 7f98d7b into master Jul 23, 2020
@rauchy rauchy deleted the load-extensions-on-db-init branch July 23, 2020 08:05
andrewdever pushed a commit to andrewdever/redash that referenced this pull request Oct 5, 2020
* Only try to create tables and stamp DB if not tables exist already.

* load extensions when creating the database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants