-
Notifications
You must be signed in to change notification settings - Fork 996
inject augur and version into engine connection args #3771
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
cc625c7
e4f9fbd
1c51481
2f11f27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
|
|
||
| from augur.application.db.engine import create_database_engine, get_database_string | ||
|
|
||
| from metadata import __version__ | ||
|
|
||
| engine = None | ||
| Session = None | ||
|
|
||
|
|
@@ -12,7 +14,7 @@ def get_engine(): | |
|
|
||
| if engine is None: | ||
| url = get_database_string() | ||
| engine = create_database_engine(url=url, poolclass=StaticPool) | ||
| engine = create_database_engine(url=url, poolclass=StaticPool, connect_args={"application_name": f"augur v{__version__}"}) | ||
| Session = sessionmaker(bind=engine) | ||
|
|
||
| return engine | ||
|
|
@@ -42,7 +44,7 @@ def get_session(): | |
| def temporary_database_engine(): | ||
|
|
||
| url = get_database_string() | ||
| temporary_database_engine = create_database_engine(url=url, poolclass=StaticPool) | ||
| temporary_database_engine = create_database_engine(url=url, poolclass=StaticPool, connect_args={"application_name": f"augur v{__version__} temporary"}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh that should probably be removed if it hasn't already. I gave up importing the version except where already available because its in the metadata.py, outside the module structure and therefore hard to properly import
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah! Probably should remove this |
||
|
|
||
| try: | ||
| yield temporary_database_engine | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0621: Redefining name 'temporary_database_engine' from outer scope (line 44) (redefined-outer-name)