Autoincrement works with sqlite command line but still
doesn't through pysqlite from Python

--- Dan McDaniel <[EMAIL PROTECTED]> wrote:

> Thanks Clay
> 
> I downloaded version 3-2-7 (Windows xp pro) for both
> my  home and office system. I am working through
> pysqlite 
> and have set up all the tables through Python with
> table creation statements like this:
> cur.execute("CREATE TABLE projects(project_id
> INTEGER
> PRIMARY KEY, \
>             cip_number INTEGER, project_name
> VARCHAR(30), project_area INTEGER, \
>             original_budget INTEGER,  start_date
> date,
> end_date date)")
>             
> I have tried adding the word 'AUTOINCREMENT' after
> the
> 'PRIMARY KEY PHRASE'  with no luck.
> 
> I have tried very simple tables. When I do and
> insert
> with a NULL value in the Primary Key column, the
> database accepts the insert with no complaint or
> errors.
> When I retrive the data, no results (rows) are
> returned for the values were NUll was inserted; only
> where I
> have explicitly listed a number  in the PK field do
> I
> get any Results.
> 
> I am going to do further experiments tomorrow by
> downloading to my Linux box. All of the tables have
> been  created from within Python2-4, none on the
> sqlite command line, so maybe that has something to
> do
> with it.
> 
> 
> I am hoping that the additional info I have given
> helps to suggest what's going on.
> 
> Thanks again Clay
> DAn 
> 
> --- Clay Dowling <[EMAIL PROTECTED]> wrote:
> 
> > Dan McDaniel wrote:
> > 
> > >I have not been able to get autoincrement to
> work.
> > I
> > >downloaded latest version several days ago to
> home
> > and
> > >office machine. Can not get it to work on either.
> > >Please help.
> > >  
> > >
> > Show us your DDL for the table.  In general the
> > field should be an
> > integer primary key.  If you do that you'll get
> auto
> > incrementing keys
> > by default.  If you tack auto_increment on to it
> > you'll get slightly
> > different behavior in the selection of keys.
> > 
> > Clay Dowling
> > 
> 
> 
> 
>               
> __________________________________ 
> Start your day with Yahoo! - Make it your home page!
> 
> http://www.yahoo.com/r/hs
> 



        
                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

Reply via email to