PierreQuentel/PyDbLite

Database columns have not been setup! - error

Closed this issue · 2 comments

hi ,
following the example from here http://pydblite.readthedocs.org/en/latest/examples.html and i get the above error when i paste this line. db.insert(name='homer', age=23, size=1.84).

full error
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from pydblite.pydblite import Base
db = Base('dummy', save_to_file=False)
db.create('name', 'age', 'size')
<pydblite.pydblite._BasePy2 object at 0x7f00f81fd110>
db.insert(name='homer', age=23, size=1.84)
Traceback (most recent call last):
File "", line 1, in
File "/home/apinto/python/projects/venv/lib/python2.6/site-packages/pydblite/pydblite.py", line 280, in insert
raise RuntimeError("Database columns have not been setup!")
RuntimeError: Database columns have not been setup!

Hi

This is a silly error the tests did not catch. Simple workaround is to pass mode='open' in create:

db.create('name', 'age', 'size', mode='open')

I'll put out a fix shortly.

Thanks for reporting.

Fixed in 7ec84c2