Sqlite application

Asked by Shiney

Hi all

Just trying to get my head around python and quickly. Anybody got any tips on writing a small sqlite based app in quickly - any templates etc that might help? Or tutorials?


Question information

English Edit question
Quickly Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Didier Roche-Tolomelli (didrocks) said :


I don't know any of sqlite application template in Quickly that some contributors have done. The ubuntu-application template uses couchdb, (with desktopcouch binding) which is very cool for storing easily data and get them synced between computers (you will find some tutorials with "$ quicky tutorial ubuntu-application".

Revision history for this message
John C Barstow (jbowtie) said :

Support for SQLite is built into the Python standard library since v2.5. It has a very simple API.


I don't know that there is anything specific that Quickly can or should provide in this regard.

Revision history for this message
Shiney (martyn-chessels) said :


Thanks for your quick responses.

I was thinking of Glade specifically, I guess. I've used Delphi and some other RAD desktop tools where they have data bound controls and was wondering if anybody had done any work binding the Glade/GTK+ widgets to sqlite tables and columns.


Revision history for this message
Rick Spencer (rick-rickspencer3) said :


In Quickly Widgets, there is a widget that binds to a Python Dictionary, and one that Binds to a record type in DesktopCouch. I'd like to create one that binds to a sqlite table as well, but I don't know that I'll have time to get to this for Maverick. Also, Quickly Widgets are not integrated with Glade quite yet, but might be for Maverick.

However, it's easy to do what you want with a quickly.widgets.DictionaryGrid. I know it's not the GUI way you are looking for yet, but that will come in later version.

Here's a quick example
from quickly.widgets.dictionary_grid import DictionaryGrid

#create a list for storing the dictionaries
work_items = []

#get stuff from the database
sql = """SELECT description, status, spec, assignee
                     FROM work_items
                     where date = '%s'
                     AND milestone = '%s'""" % (d , "maverick-alpha-2")
cursor.execute(sql )

#build the list of dictionaries from the data
for r in cursor:
    wi = {"Item":r[0].strip(),

#build your grid and add it to the window
grid = DictionaryGrid(dictionaries = work_items)

I you want to make it editable, pass in "editable=True" when you create it, and connect to the cell-edited signal, and update the database from the signal handler.


Revision history for this message
Shiney (martyn-chessels) said :


OK - Thanks for that - this is just what I wanted. I've just used a version of this code against one my db tables and it works a treat.

I guess if I use an object-mapper like sqlalchemy then its even easier.

Thanks again


Can you help with this problem?

Provide an answer of your own, or ask Shiney for more information if necessary.

To post a message you must log in.