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

Check for database tables before starting the server #140

Open
gridhead opened this issue Dec 9, 2021 · 0 comments
Open

Check for database tables before starting the server #140

gridhead opened this issue Dec 9, 2021 · 0 comments

Comments

@gridhead
Copy link
Collaborator

gridhead commented Dec 9, 2021

For people using the default configuration which is present in the repository, mistakenly or not, they would end up using an in-memory database. The application would start, no problem - but performing any path operation would result in referencing tables that do not exist, thereby causing an error and an exception message which is not very elegant.

(venv) [t0xic0der@fedorable duffy]$ duffy -c etc/duffy-example-config.yaml serve 
 * Starting Duffy...
 * Host address : 127.0.0.1
 * Port number  : 8080
 * Log level    : warning
 * Serving API docs on http://127.0.0.1:8080/docs
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/t0xic0der/Projects/duffy/venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/home/t0xic0der/Projects/duffy/venv/lib64/python3.10/site-
.
.
<SOME MORE HUNDREDS OF BROWSER-CRASH-INDUCING LINES OF UNINDICATIVE EXCEPTION MESSAGE>

What do we do then?

Simple, we repurpose the code from here #132 to inspect the database that the config file points towards. If we do not find them the way we want them to - i.e. if it does not have the columns of the names and the types we are looking for, we do NOT start the application.

@gridhead gridhead added the bug label Dec 9, 2021
@nphilipp nphilipp added the polish label Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants