PyQt + PygreSQL

Discussion in 'Python' started by Neil Zanella, Aug 10, 2004.

  1. Neil Zanella

    Neil Zanella Guest

    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
     
    Neil Zanella, Aug 10, 2004
    #1
    1. Advertising

  2. 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 <> 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/
     
    Grzegorz Dostatni, Aug 10, 2004
    #2
    1. Advertising

  3. Neil Zanella

    Neil Zanella Guest

    Grzegorz Dostatni <> wrote in message news:<>...

    > 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
     
    Neil Zanella, Aug 11, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. trewornan

    pygresql

    trewornan, Jun 28, 2003, in forum: Python
    Replies:
    1
    Views:
    798
    Skip Montanaro
    Jun 28, 2003
  2. ulysses
    Replies:
    4
    Views:
    785
    Werner Schiendl
    Oct 22, 2003
  3. Benjamin Arai
    Replies:
    0
    Views:
    280
    Benjamin Arai
    Feb 1, 2004
  4. Radu Stanciu
    Replies:
    2
    Views:
    358
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Feb 18, 2004
  5. Chuck Amadi
    Replies:
    4
    Views:
    850
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Jun 19, 2004
Loading...

Share This Page