Re: recommended way to insert data into a one to many relationship using python

2010-05-03 Thread Wolfgang Meiners
Wolfgang Meiners schrieb: [... example of a simple sql-database and relating questions ...] so after reading the hints of Peter Otten and Bryan i played around a bit and got the following solution. Of course it would be much simpler following Bryans idea of natural keys but i think, i will go ste

Re: recommended way to insert data into a one to many relationship using python

2010-05-03 Thread Wolfgang Meiners
Bryan schrieb: > Wolfgang Meiners wrote: >> one to many relationships are fairly common, i think. So there should be >> a recommended way to insert data into such a relation using python. >> >> Given the following programm, what is the recommended way to insert the >> list of NewEmployees to the da

Re: recommended way to insert data into a one to many relationship using python

2010-05-02 Thread Wolfgang Meiners
Peter Otten schrieb: > Peter Otten wrote: > > If you create indices for floors (and rooms) > > cur.execute("""create unique index room_index on rooms (fid, number);""") > cur.execute("""create unique index floor_index on floors (floor);""") > > the addition of missing rows can be simplified to >

Re: recommended way to insert data into a one to many relationship using python

2010-05-02 Thread Bryan
Wolfgang Meiners wrote: > one to many relationships are fairly common, i think. So there should be > a recommended way to insert data into such a relation using python. > > Given the following programm, what is the recommended way to insert the > list of NewEmployees to the database? > > ==

Re: recommended way to insert data into a one to many relationship using python

2010-05-02 Thread Peter Otten
Peter Otten wrote: If you create indices for floors (and rooms) cur.execute("""create unique index room_index on rooms (fid, number);""") cur.execute("""create unique index floor_index on floors (floor);""") the addition of missing rows can be simplified to missing = c2.execute("""select distin

Re: recommended way to insert data into a one to many relationship using python

2010-05-01 Thread Peter Otten
Wolfgang Meiners wrote: > Hi, > > one to many relationships are fairly common, i think. So there should be > a recommended way to insert data into such a relation using python. > > > Given the following programm, what is the recommended way to insert the > list of NewEmployees to the database?

recommended way to insert data into a one to many relationship using python

2010-05-01 Thread Wolfgang Meiners
Hi, one to many relationships are fairly common, i think. So there should be a recommended way to insert data into such a relation using python. Given the following programm, what is the recommended way to insert the list of NewEmployees to the database?