By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,231 Members | 1,707 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,231 IT Pros & Developers. It's quick & easy.

PyQt + PygreSQL

P: n/a
Hello,

I am using the following with python:

The PyQt python bindings:

http://www.riverbankcomputing.co.uk/pyqt/

based on the Qt GUI Application Framework:

http://www.trolletch.com/

as well as the PyGreSQL python bindings:

http://www.pygresql.org/

based on the PostgreSQL database server:

http://www.postgresql.org/

I have the following question. When I instantiate QDataTable with C++
I must ensure that a database connection is open, and then have no
problems, otherwise I will get popup widgets with errors.

How can I properly set the default database connection and have
QDataTable find it using the combination of Python + PyQt + PyGreSQL?

Thanks,

Neil
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

I don't know how to set it up using pygresql, but you can do it using
qtsql module. Just make sure that qt was compiled with the postgresql
support.

If you need to use pygresql for some reason, you could always try to have
multiple connections to the database from you code (one through qtsql
module, another through qtsql). That will probably get very ugly very
quickly.

Greg
On 10 Aug 2004 13:43:05 -0700, Neil Zanella <nz******@cs.mun.ca> wrote:

I have the following question. When I instantiate QDataTable with C++
I must ensure that a database connection is open, and then have no
problems, otherwise I will get popup widgets with errors.

How can I properly set the default database connection and have
QDataTable find it using the combination of Python + PyQt + PyGreSQL?

Thanks,

Neil


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 18 '05 #2

P: n/a
Grzegorz Dostatni <do*******@yahoo.com> wrote in message news:<op**************@news.srv.ualberta.ca>...
I don't know how to set it up using pygresql, but you can do it using
qtsql module. Just make sure that qt was compiled with the postgresql
support.
Thanks, I should have used the Python equivalent of QSqlDatabase::addDatabase()
to connect to PostgreSQL instead of using PyGreSQL. That way QDataTable can
find and use the database connection handle it knows about. After all, PyQt
knows nothing about PyGreSQL: as you just pointed out the two packages are
completely unrelated and independent of each other.
If you need to use pygresql for some reason, you could always try to have
multiple connections to the database from you code (one through qtsql
module, another through qtsql).


Exactly, but actually now that you pointed this out to me I don't think
I will need PyGreSQL since I'm already using the Qt database module.

Thanks,

Neil
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.