How do I know which version of sqlite web2py is using? I have both sqlite 2.8.17 and 3.6.21 installed on my system. Do I need to set LIBPATH specifically?
Thanks for the help, Christopher Helck On Mon, Jan 4, 2010 at 10:14 PM, mdipierro <[email protected]> wrote: > I just tried it on mine: > >>> db=DAL('sqlite://test.db') > >>> db.define_table('foo', Field('name', unique=True)) > >>> db.foo.truncate() > >>> db.foo.insert(name='joe') > 1 > >>> db.foo.insert(name='sally') > 2 > >>> db.foo.insert(name='joe') > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "/Users/mdipierro/web2py/gluon/sql.py", line 1849, in insert > self._db._execute(query) > File "/Users/mdipierro/web2py/gluon/sql.py", line 891, in <lambda> > self._execute = lambda *a, **b: self._cursor.execute(*a, **b) > IntegrityError: column name is not unique > >>> > >>> print "Tables" > Tables > >>> print db().select(db.foo.ALL) > foo.id,foo.name > 1,joe > 2,sally > > > I guess you have a buggy version of sqlite. I would also try delete > everything in databases/ and try again. In case something was > corrupted with the .table files. > > On Jan 4, 8:39 pm, Christopher Helck <[email protected]> > wrote: > > My DB skills are not strong, so please forgive if this is a dumb > question. > > Why does the following from my db.py not do what I want it to do? > > ################# > > db.define_table('foo', Field('name', unique=True)) > > > > db.foo.truncate() > > db.foo.insert(name='joe') > > db.foo.insert(name='sally') > > db.foo.insert(name='joe') > > > > print "Tables" > > print db().select(db.foo.ALL) > > > > db.commit() > > ################### > > Because I've defined the field 'name' to be unique, I expected some sort > of > > error to occur the second time I insert the row containing 'joe'. > Instead, I > > end up with a table with three rows: joe, sally, and joe. I'm using > SqlLite. > > > > Thanks, > > C Helck > > -- > > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<web2py%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

