sqlite3 views, if not exists clause
Tim Golden
Tim.Golden at viacom-outdoor.co.uk
Tue Nov 14 08:52:18 EST 2006
[Josh]
| I'm running into a problem when trying to create a view in my sqlite
| database in python. I think its a bug in the sqlite3 api that
| comes with python 2.5.
| THIS DOES NOT WORK, but it should!
| conn = sqlite3.connect(':memory:')
| conn.execute("create table foo (a int,b int)")
| conn.execute('create view if not exists bar as select * from foo')
| it fails with exception "sqlite3.OperationalError: near
| "not": syntax error"
Not a bug with the "sqlite3 api that comes with python 2.5." as such,
since .execute pretty much passes its parameters through to the database
engine. Rather, the syntax you're using is a relatively late addition
to the sqlite libs -- at least it fails on my 3.2.1 version of the
sqlite3 commmand-line tool, but succeeds on the latest download (3.3.8).
I presume therefore that you build of Python is linked against an
older version of the sqlite libraries / DLL.
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-list
mailing list