Confusing message when trying to use PostgreSQL

Issue #655 resolved
Former user created an issue

The following code:

import sqlalchemy

database = sqlalchemy.create_engine("postgres://localhost:5432/nslater")

Generates the following traceback:

Traceback (most recent call last):
  File "test.py", line 3, in ?
    database = sqlalchemy.create_engine("postgres://localhost:5432/nslater")
  File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/__init__.py", line 91, in create_engine
    return strategy.create(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/sqlalchemy/engine/strategies.py", line 52, in create
    raise exceptions.InvalidRequestError("Cant get DBAPI module for dialect '%s'" % dialect)
sqlalchemy.exceptions.InvalidRequestError: Cant get DBAPI module for dialect '<sqlalchemy.databases.postgres.PGDialect object at 0xf7e30250>'

This message means absolutely nothing to me. Is there a missing dependency, a bug in the code or something else more exotic.

Comments (2)

  1. Former user Account Deleted

    It turns out my copy of python-psycopg was out of date. This error message still needs to be cleaned up though. Something like the following would be more explicit:

    "Unable to use psycopg2 module as DBAPI for dialect postgres. Please check this module is installed correctly at your site."

  2. Mike Bayer repo owner

    no clue what ancient version of SQLAlchemy you're using, theres no wrapping of the ImportError as of many versions ago. changed the name of the "import" in my postgres.py module to "psycopg23" to force a raise of the error, both 0.3.10 and 0.4 trunk produce:

    ImportError: No module named psycopg23
    
  3. Log in to comment