FedericoCeratto/bottle-cork

SqlAlchemy Backend Initialization error for sqlite databases

Opened this issue · 2 comments

In SQLite, the "CREATE DATABASE %s" and "USE %s" queries fail with syntax errors.

example:

SqlAlchemyBackend('sqlite:///' + absolute_path_to_dbfile, initialize=True)

fails with

sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file None None

This is caused by sqlalchemy_backend.py:138, where db_url should be db_full_url.

Now the error is

localhost - - [2014-08-19 09:36:18,563] Failed DB creation: (OperationalError) near DATABASE": syntax error 'CREATE DATABASE auth.sqlite' ()
sqlalchemy.exc.OperationalError: (OperationalError) near "USE": syntax error 'USE auth.sqlite' ()

The CREATE DATABASE error is caught via exception handling, but the USE query error is not.

Is it possible to make the SqlAlchemy backend work with file based sqlite?

I am using the latest bottle-cork package available from pip.

Thanks for the bug report, I'll add file-based sqlite functional testing and fix the issue.

How far we are from releasing v0.12 and patch this?