Re: Problem with sqlite

2008-03-31 Thread Gerhard Häring
aiwarrior wrote: > [...] > What i'm going to study is whether it's possible to evaluate if a > table already exists, and if so act accordingly. [...] You can use a statement like "CREATE TABLE IF NOT EXISTS tbl(col1, col2);". If you just want to check, you can query SQLite's schema metadata with

Re: Problem with sqlite

2008-03-30 Thread aiwarrior
Ok regarding Gerhard's comment of the try, except, pass, i came to understand that it's really bad code. And i should have referred that i put that there be cause i was getting: Traceback (most recent call last): File "C:\Python25\Projects\cp.py", line 48, in db = db() File "C:\Python25\P

Re: Problem with sqlite

2008-03-30 Thread aiwarrior
Ok regarding Gerhard's comment of the try, except, pass, i came to understand that it's really bad code. And i should have referred that i put that there be cause i was getting: Traceback (most recent call last): File "C:\Python25\Projects\cp.py", line 48, in db = db() File "C:\Python25\P

Re: Problem with sqlite

2008-03-29 Thread Carsten Haese
On Mar 29, 9:10 pm, Tim Roberts <[EMAIL PROTECTED]> wrote: > aiwarrior <[EMAIL PROTECTED]> wrote: > >def get_value( self, column ): > >self.cursor.execute( "SELECT %s FROM database" % column ) > >for n in self.cursor: > > print n > > I suspect you wanted "self.cursor

Re: Problem with sqlite

2008-03-29 Thread Tim Roberts
aiwarrior <[EMAIL PROTECTED]> wrote: > >I'm sorry about not saying showing the libraries. It was not on >purpose. You didn't make any comment on the rest of Gerhard's suggestion, nor does it appear that you took any action to correct them. You should get out of the habit of using extra parenthese

Re: Problem with sqlite

2008-03-29 Thread Tzury Bar Yochay
after executing insert do conection.commit() -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with sqlite

2008-03-29 Thread aiwarrior
On Mar 29, 6:41 pm, Gerhard Häring <[EMAIL PROTECTED]> wrote: > Ok, I'll review your code. > > aiwarrior wrote: > > class db: > > def __init__(self): #constructor > > conn = sqlite3.connect('./db.db') > > conn.isolation_level = None > > Autocommit mode is mostly for newbies who

Re: Problem with sqlite

2008-03-29 Thread Gerhard Häring
Ok, I'll review your code. aiwarrior wrote: > class db: > def __init__(self): #constructor > conn = sqlite3.connect('./db.db') > conn.isolation_level = None Autocommit mode is mostly for newbies who forget to call commit. Unfortunately, newbiews find enough other ways to shoot

Re: Problem with sqlite

2008-03-29 Thread Duncan Booth
aiwarrior <[EMAIL PROTECTED]> wrote: > When i execute this the database doesn't get filled with anything and > the program stays running in memory for ever. That's odd, when I execute the code you posted I just get "NameError: global name 'sqlite3' is not defined". You should always try to post