Search code examples
pythonpostgresqlpgdb

AttributeError: 'module' object has no attribute 'connect' in the pgdb module using python


    import pgdb
    myConnection = pgdb.connect( host=hostname, user=username, password=password, database=database )
    doQuery( myConnection )
    myConnection.close()

I get the following error when i run the script.

>>> AttributeError: 'module' object has no attribute 'connect'. Please help me out

Solution

  • The classname is Connection in the repo https://github.com/KehaoWu/pgdb/blob/master/pgdb/pgdb.py#L15

    PYPY project pypi.org/project/pgdb