Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Add mysql backend support #4

Open
brainkiller opened this issue Apr 25, 2020 · 4 comments
Open

Add mysql backend support #4

brainkiller opened this issue Apr 25, 2020 · 4 comments

Comments

@brainkiller
Copy link

Would it be possible to also add mysql support ?
I have SBFspot running with mysql instead of SQLite
I just came across this project and it looks great but it doesn't support the mysql engine :(

Or is there another way to achieve this ?

@philipptrenz
Copy link
Owner

Hi @brainkiller,

sure it's possible! You'll have to change util/database.py, change the database connector and translate the queries from sqlite to mysql. I'm not sure if the database structure is the same for mysql, but it shouldn't be such a big deal.

Nevertheless I'm currently thinking about to replace the SBFspot database and import the CSVs directly via Telegraf into InfluxDB and display the graphs via Grafana. So maybe this is also a good way for you to go.

Hope that helps you out!

@brainkiller
Copy link
Author

I just did some hacking in the database.py and got it working using mysql (based on nfsprodriver-dev branch).
I just need to see how I can pass the connection details to database.py
Once I figured that out I can post a patch/pull request if you want.

@philipptrenz
Copy link
Owner

Nice!
You can access the YAML file directly by calling self.config.config from database class, e.g. self.config.config["database"]["path"].

A pull request would be nice, then I can add support for both backends ;)

@brainkiller
Copy link
Author

I've just created pull request #5.
I suppose you'll want to adapt the code still a bit to support both sqlite and mysql instead of just one or the other

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants