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

MySQL connections fail due to SQLite specific config in DbConfig #999

Open
pUrGe12 opened this issue Feb 4, 2025 · 0 comments
Open

MySQL connections fail due to SQLite specific config in DbConfig #999

pUrGe12 opened this issue Feb 4, 2025 · 0 comments

Comments

@pUrGe12
Copy link

pUrGe12 commented Feb 4, 2025

I have set up a MySQL database using systemctl start mysql and it all works. The host and port are "localhost" and 3306 respectively with username "root".

I have filled these credentials in the config.py file as well and changed the engine parameter to mysql.

Firstly I think the docstring for those functions are not updated because it calls for renaming of variables that are no longer present, but from what I figured the name under the DbConfig class refers to the database name.

Given all these, I am still unable to connect to the server. The following seem to be the issue:

  1. The create_engine() command is not working because the interpreter never crosses that line of code (found through debug statements).
  2. The database name passed to the mysql server is .data/nettacker.db which is invalid for MySQL databases and only works for SQLite. So the command CREATE DATABASE path/to/.data/nettacker.db gives an error.

The default config for DbConfig class is sqlite and that requires the nettacker.db file which is why the product works if no one tries to change the DbConfig.

Proposed solution:

  1. Update the docstring for the DbConfig class
  2. Use pymysql as a bridge to allow direct SQL connections and queries in the mysql.py file
  3. Update the db.py file to allow both MySQL and SQLite
  4. Increase the max connections for the server (user/admin has to do this)

I have tried these locally and they seem to work well. Let me know if you want me to push these changes for you to review.

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

1 participant