postgres and kivy

1,216 views
Skip to first unread message

John Fabiani

unread,
Jan 5, 2012, 1:23:09 PM1/5/12
to kivy-...@googlegroups.com
Hi newbie question:
Is it possible to connect to a postgres database?

Johnf

Mathieu Virbel

unread,
Jan 5, 2012, 1:24:40 PM1/5/12
to kivy-...@googlegroups.com
Hi,

What's the relation with Kivy?
You're question is more general to python, prefer to use
stackoverflow.com for that kind of questions :)

And search for "postgresql python" in google or pypy, you'll get lot of
answers already.

Mathieu

John Fabiani

unread,
Jan 5, 2012, 1:43:59 PM1/5/12
to kivy-...@googlegroups.com
I can of course access postgres using psycopg2 or pg8000.  But I was wondering if I can associate the data to a kivy control?

Johnf

Mathieu Virbel

unread,
Jan 5, 2012, 1:46:44 PM1/5/12
to kivy-...@googlegroups.com
You might be interested of something like this:

http://wiki.kivy.org/Updating%20widget%20content%20from%20a%20items%20list

John Fabiani

unread,
Jan 5, 2012, 1:53:12 PM1/5/12
to kivy-...@googlegroups.com
that might work - thanks
Johnf

Jasmal Py

unread,
Aug 13, 2015, 1:11:48 AM8/13/15
to Kivy users support
link which you mentioned not found, :'(

サムエル テイェイラ サントス

unread,
Aug 13, 2015, 8:46:29 PM8/13/15
to Kivy users support

Dominique Meurisse

unread,
Sep 10, 2015, 4:49:01 PM9/10/15
to Kivy users support
This question make sense if you are willing to write an Company App on an Android Phone (ex: Inventory Pickup software linked to our enterprise software).
I would like to grab the data directly from the PostgresSql database (instead of writing a dedicated service + Kivy Twisted).

So would Kivy (running on Android) been able to grab data from Postgresql database?

Bill Eaton

unread,
Sep 11, 2015, 12:08:51 AM9/11/15
to Kivy users support
It seems the original poster's question was whether Kivy widgets support data binding. Regrettably, Kivy widgets are not data aware and there is no built in datagrid, though others have projects on GitHub that try to provide datagrids:
   https://github.com/pedrodgcouto/Kivy.DataGrid
   https://github.com/namkazt/Kivy-Datagrid-plugin
I haven't tried either so I cannot recommend them one way or the other.

If you can get the data into a list, then you can put it into a ListView. The Python DBI 2.0 API interface provides lists and dictionaries from a database. I've successfully used psycopg2 with Kivy on a desktop machine, but I'm not sure if there is a way to bake it into your Android apk.

Actually, that's a really good question: Is there a way to bake in support for a querying large external databases (e.g. MSSQL, Oracle, DB2, PostgreSQL, MySQL, etc) into an Android/IOS app?

These days, I've been using sqlite to store offline data locally in my Android app. To view the data, I take the data from a DictCursor and convert it to a list row by row. Then I attach the list to a ListView widget. To make it look pretty, I use a monospace font and pad each field with a fixed number of spaces. It's doesn't look as good as a nice datagrid. Nor does it provide any convenient sorting mechanism, but it does work.

Good luck!

John Fabiani

unread,
Sep 11, 2015, 9:44:50 AM9/11/15
to Kivy users support
I have been able to access data directly from a postgres database on the lan or wan by using P8000 from an android tablet.  That said, I soon discovered that I could not do the same for MS-SQL.  All of the available python interfaces for MS-SQL required other modules that kivy did not support on android (worked well on the desktop).  So in the case of the MS-SQL I was forced to write a restful api (I used Flask) to gain access to the MS-SQL database.  
Johnf
Reply all
Reply to author
Forward
0 new messages