A python app has been successfully configured with the MySQL connector to write records to a small table to demonstrate a concept (very low volume of writes).

I will need to write to a database and read them back. I was hoping I could recreate the small table on Kodi's database and write with the MySQL connector. I then found out that SQLite (and not MySQL) is the Kodi RDBMS.

I suspect that that it is unlikely that I can use the MySQL connector to write to the Kodi's SQLite database (I am reluctant to experiment because I do not want to bork up the database). That being said:

  • Is it possible to read / write records with the python MySQL connector to a SQLite RDBMS?

  • If it is not possible: what pitfalls must be avoided when installing mySQL alongside Kodi?

If you have successfully performed either please indicate this in your response along with any lesson learned \ pitfalls to avoid? Thank you

  • Although I'm not a python user, I assume the standard there is what it is in most other high level interpreted languages: Code for accessing an SQL database will be much the same regardless of which particular flavour it is. Although you should still be free to use non-standard features specific to a particular RDBMS, you do not have to, which means other than configuring and initializing the driver/adapter, you can use the same code with sqlite as mysql, etc. – goldilocks Feb 7 '18 at 16:04

Even if you could, why would you? If you want to work with a sqlite database you'd use a python sqlite library. Also you wouldn't want to test with kodi's sqlite database. You can create a new sqlite database by issuing the command "sqlite mydatabase.db", then create a table, and add some test data. With sqlite you can create as many databases as you want, you're not limited to just one. Search creating a sqlite database.

With mysql you can also have as many databases as you want. If it's not installed, you can install it by following the "installing Mysql" link you provided. You can create a separate user and your own database so you don't need to worry about messing up kodi or osmc.

Issue the folling commands to create a new database and user

mysql -p -u root create database mytestdb; grant all privileges on mytestdb.* to 'myname'@'localhost' identified by 'mypassword'; use mytestdb;

Use your favorite search engine to find out how to create a table and insert some test data. Now you'll be able to use python mysql on you own mysql test database without worrying about borking kodi. Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.