How can I insert user data into my mysql database from my kivy app?

1,089 views
Skip to first unread message

mahmud al hasan

unread,
Jun 1, 2018, 12:18:29 AM6/1/18
to Kivy users support
I have created an application which is showing data as a list. Now what I want to do is to insert it to my database. 
Also, is there anything like content providers or something which can be used like it is used for native android app?

 

ZenCODE

unread,
Jun 1, 2018, 4:18:08 PM6/1/18
to Kivy users support
Where is your database? Why don't you use the built in sqlite db? What kind of content providers? If you can be more specific and outline your needs more clearly, perhaps we can be more helpful...

mahmud al hasan

unread,
Jun 2, 2018, 12:09:56 AM6/2/18
to Kivy users support


On Saturday, June 2, 2018 at 2:18:08 AM UTC+6, ZenCODE wrote:
Where is your database? Why don't you use the built in sqlite db? What kind of content providers? If you can be more specific and outline your needs more clearly, perhaps we can be more helpful...

Thank you for replying my question. Here is my code-

from kivy.lang import Builder
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
import platform
Builder.load_string('''
#: import uname platform.uname
<SystemInfoInterface>:
    BoxLayout:
        orientation: 'vertical'

        Button:
            text: 'Press'
            on_press: label.text = str(root.info())
        Label:
            id: label
''')


class SystemInfoInterface(BoxLayout):
    
    def info(self):
        myList = []
        for i in platform.uname():
            # print(i[0],':',i[1])
            #print(i)
            myList.append(i)
        #print(myList)
        return myList

class SystemInfoApp(App):

    def build(self):
        return SystemInfoInterface()

if __name__ == "__main__":
    SystemInfoApp().run()


In here I am returning a list which I want to insert into a MySQL database which I haven't created yet. I was hoping if there any content providers for kivy application for this purpose.

What you mean by built in sqlite db? Should I have to convert sqlite to MySQL for this purpose?   

ZenCODE

unread,
Jun 2, 2018, 12:38:08 PM6/2/18
to Kivy users support
A MySQL database only makes sense if you plan heavy, multi-user access. Python (and hence Kivy) provides sqlite built it. This is much more lightweight and makes much more sense for single user applications.. MySQL is more for servers and you would need to install extra libraries and connectors to use it.

mahmud al hasan

unread,
Jun 4, 2018, 12:29:56 AM6/4/18
to Kivy users support


On Saturday, June 2, 2018 at 10:38:08 PM UTC+6, ZenCODE wrote:
A MySQL database only makes sense if you plan heavy, multi-user access. Python (and hence Kivy) provides sqlite built it. This is much more lightweight and makes much more sense for single user applications.. MySQL is more for servers and you would need to install extra libraries and connectors to use it.


This is just a demo code, of-course this project will need multi-user access. So, how can I use MySQL for that? I have live database access too.    

ZenCODE

unread,
Jun 4, 2018, 1:59:26 PM6/4/18
to Kivy users support
Then you would need to use a MySQL connector. See the post below might help.


Feel free to google for other posts if that does not help. It has been done...

Good luck

mahmud al hasan

unread,
Jul 2, 2018, 5:55:44 AM7/2/18
to Kivy users support
The problem solved! I have included some requirements in the spec file which solved the issue.

requirements = kivy,requests,openssl,urllib3,futures,kivymd
Reply all
Reply to author
Forward
0 new messages