SQLITE engine doesn't work with sqlite version 2.8.17

Issue #654 resolved
Former user created an issue

Running the following code:

import sqlalchemy

database = sqlalchemy.create_engine('sqlite://publish.db')

Results in this traceback:

Traceback (most recent call last):
  File "test.py", line 3, in ?
    database = sqlalchemy.create_engine('sqlite://publish.db')
  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 41, in create
    dialect = module.dialect(**dialect_args)
  File "/usr/lib/python2.4/site-packages/sqlalchemy/databases/sqlite.py", line 148, in __init__
    self.supports_cast = (sqlite is not None and vers(sqlite.sqlite_version) >= vers("3.2.3"))
AttributeError: 'module' object has no attribute 'sqlite_version'

In the Python interpreter I can see that the sqlite module has the "version" attribute but not a "sqlite_version" attribute.

Comments (6)

  1. Former user Account Deleted

    It turns out I was using pysqlite 1.0.1 which doesn't have this attribute.

    Would it be possible to update SA to check for the legacy attribute "version" and warn that a newer version of the library is needed?

  2. Former user Account Deleted
    • removed status
    • changed status to open

    I think you have made a mistake. That revision does not fix this issue.

  3. Former user Account Deleted
    • removed status
    • changed status to open

    I appreciate that sqlite2 is not supported by SQLAlchemy. I am not asking you to support it.

    I am suggesting that you provide a more helpful error message to the user when things don't work.

    I tried to get SQLAlchemy working using Debian packages so you can be sure I am not the only one who has experienced this problem.

  4. Mike Bayer repo owner

    changeset:3099 removes the old import of 'sqlite'. so now you'll get:

    ImportError: No module named pysqlite2
    

    which is how all the db's react when their expected module is not found.

  5. Log in to comment