It's been almost 2 years since I've done anything
with Python and SQLite and I'm having some problems
that I don't recall from my last usage ....
It seems that SQLite3 data bases created at the command line
and those created using the sqlite module from within Python
are no longer compatible with each other using the setup that
I now have ....
I thought I remembered that the data bases created either way
were always 100% transparent with each other and that I could
use an SQLite3 data base either from the command line or from
within Python without any problems at all ....
I did a fair amount of Google-izing looking for related problems
but didn't have much success ....
I did find one entry in the Debian Bug Tracking System
that had some discussions about SQLite3 & Python-SQLite versioning
but the original errors mentioned didn't seem to be of the same nature
as what i'm seeing here ....
================================================== =========
Operating System .... Debian GNU/Linux Sarge
python2.3 ........... Installed : 2.3.5-3sarge2
python2.3-sqlite .... Installed : 1.0.1-2
sqlite3 ............. Installed : 3.2.1-1
libsqlite3-0 ........ Installed : 3.2.1-1
Date SQLite3 Data Base Created Via
========== ================= ===========
2005-02-20 .... abook_00.sql3 ......... sqlite3 command line
2006-11-23 .... abook_01.sql3 ......... python module
SQLite3 data bases created via the command line
and those created using the python2.3-sqlite package
version 1.0.1-2 from within a Python program
are not compatible with each other ....
If I create an SQLite3 data base from the command line
and populate it with data, then I cannot use that db
from Python ....
If I create an SQLite3 data base from within Python
and populate it with data, then I cannot use that db
from the command line ....
The following console sessions illustrate the problem ....
================================================== =========
# Using an SQLite3 data base created at the command line
$ sqlite3 abook_00.sql3
SQLite version 3.2.1
Enter ".help" for instructions
sqlite>
sqlite.schema
CREATE TABLE addr( nid int ,
atype int ,
aid int ,
address varchar( 128 ) );
CREATE TABLE names( nid int,
name varchar( 32 ) );
sqlite>
sqlite.mode column
sqlite.width 16 32
sqlite>
sqliteselect names.name , addr.address
...from names , addr
...where names.nid = addr.nid ;
Bugs Bunny Rabbit Hole 0
Donald Duck Duck Pond 1
Goofy G Hut 2
Mickey Mouse Mouse Hole 3
Sylvester Cat House 4
sqlite>
================================================== =========
# Try to query that data base from within Python
$ python abook_select.py abook_00.sql3
Traceback (most recent call last):
File "abook_select.py", line 18, in ?
dbc = sqlite.connect( db = path_db )
File "/usr/lib/python2.3/site-packages/sqlite/__init__.py", line 61, in connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.3/site-packages/sqlite/main.py", line 445, in __init__
self.db = _sqlite.connect(database, mode)
_sqlite.DatabaseError: file is encrypted or is not a database
================================================== =========
# Try the same query on a Python-created data base
$ python abook_select.py abook_01.sql3
abook_select.py
Name ............ Address
Donald Duck .... Duck Pond 1
Bugs Bunny .... Rabbit Hole 0
Mickey Mouse .... Mouse Hole 3
Goofy .... G Hut 2
Sylvester .... Cat House 4
================================================== =========
# Try to use the Python-created data base from the command line
$ sqlite3 abook_01.sql3
SQLite version 3.2.1
Enter ".help" for instructions
sqlite>
sqlite.schema
Error: file is encrypted or is not a database
sqlite>
--
Stanley C. Kitching
Human Being
Phoenix, Arizona
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----