Re: [Tutor] CSV -> sqlite tables with foreign keys

2012-10-17 Thread Monte Milanuk
Thanks for the help! Not sure why I assumed that csv.reader was returning row as a tuple instead of a list... that makes that part easier ;) As for the 'INSTEAD OF' trigger on a VIEW... that *does* look pretty handy. I was trying to remember why I hadn't heard of that before, or why I hadn't loo

Re: [Tutor] CSV -> sqlite tables with foreign keys

2012-10-17 Thread eryksun
On Tue, Oct 16, 2012 at 11:59 PM, Monte Milanuk wrote: > > address = list(row) > address.append(person) > row = tuple(address) The rows from the csv.reader are already lists. Also, the parameter list in the 2nd argument only needs to be a sequence (e.g. tuple, list, string

Re: [Tutor] CSV -> sqlite tables with foreign keys

2012-10-16 Thread Hugo Arts
On Wed, Oct 17, 2012 at 5:59 AM, Monte Milanuk wrote: > Hello, > > I'm working on a python script to take the sql script, create a sqlite3 > database, create the tables, and then populate them using the info from the > csv file. > The sticking point seems to be creating the foreign keys between t

[Tutor] CSV -> sqlite tables with foreign keys

2012-10-16 Thread Monte Milanuk
Hello, I'm working on a python script to take the sql script, create a sqlite3 database, create the tables, and then populate them using the info from the csv file. The sticking point seems to be creating the foreign keys between the tables I've got a data file with lines like this: "John","G.",