[PyQt] postgresql

Stuart McGraw smcg2297 at frii.com
Thu Mar 19 00:03:53 GMT 2009


> From: Damien Elmes [mailto:resolve at ichi2.net]
>
> I used wxwidgets for a while for my app (http://ichi2.net/anki) which
> runs on Linux, Win32 and Mac. It was really painful. Compared to pyqt,
> there were many platform specific bugs I had to work around, and at
> the time wxwidgets' "rich text widget" on Mac did not even support
> text centering. I moved to pyqt and never looked back.
>
> As for DB support, I prefer to do it in python and use sqlalchemy, as
> an ORM makes certain operations a lot more convenient.
>
> 2009/3/17 Stuart McGraw <smcg2297 at frii.com>:
> > Hello All,
> >
> > I am trying to decide on a GUI toolkit to use in a
> > Python application that has lot of database (Postgresql)
> > interaction.
> >
> > I have never used PyQt, used WxPython a little, but have
> > not used any GUI toolkit enough to make a decision based
> > on personal experience, hence this request for some guidance.
> >
> > Is it true the stock PyQt for Windows does not come with a
> > database driver for PostgreSQL?  (I am using version Postgresql
> > 8.3.5 if it matters).  Is a windows binary available anywhere
> > that has whatever is needed to work with Pg?
> >
> > Alternatively, is it possible to use Qt's SQL-based controls
> > with a Python DBI database driver (pysopg2 for example)?
> >
> > Finally (no intent to troll), any comments on the ease or
> > lack thereof, developing database apps in PyQt vs other
> > GUI toolkits (wxPython, Dabo, etc)?

Thanks for the info, (and also to the several people who made
similar recommendations by mail.)

After looking at the docs a little (still have a lot of reading
to do) my understanding was that the PyQt database-aware classes
like Qsql.TableModel, Qsql.TableView, etc, would handle getting
data from the database when needed, allow user editing of the
data, and handle writing it back to the database when changed.

Are you saying I should forget about using these data-aware
classes and just code the database communication myself (using
Sql Alchemy, Elixer, or whatever) and standard controls like
text boxes etc?

I was kind of hoping that PyQt's Qsql classes could save me some
work, but AFAICT, I need a Qsql.Database object to use them and
but a Postgreql driver is not available in binary for Windows.
So an alternative would be to reimplement the Qsql classes using
based on the Python DBAPI protocol, but maybe the cost/benefit ratio
for that is too high?  (Or maybe someone has already done it?)

BTW, I use Anki so thank you very much for that!



More information about the PyQt mailing list