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

Host hardcoded in creation of sqlalchemy engine #5

Open
egillax opened this issue Sep 25, 2023 · 1 comment
Open

Host hardcoded in creation of sqlalchemy engine #5

egillax opened this issue Sep 25, 2023 · 1 comment

Comments

@egillax
Copy link

egillax commented Sep 25, 2023

I think in general the sqlalchemy.create_engine needs to be revised. To get it working for me I used:

engine = sqlalchemy.create_engine(f`postgresql://{config.user}:{config.password}@{config.host}/{config.dbname}`, echo=False)

Then I added user, password and host to the config file.

Might also be worth refactoring the engine creation and session execution out into a separate function since it's included in multiple functions and is always the same (that I've seen so far)

@cxji
Copy link
Contributor

cxji commented Sep 25, 2023

Thanks for suggesting the refactoring! Since it seems like how the engine is specified depends on how the database is set up, I added a create_sqlalchemy_engine function to config.py for users to specify how to create engines for their set-ups.

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

No branches or pull requests

2 participants