[web2py] Initial db setup using csv import for relational tables?

2012-01-25 Thread vtgorilla
Hi, first post so go easy on me! I have two tables setup as shown below. I have a lot of data (thousands of lines) that I'd like to import, but I can't seem to figure out an easy way to relate the players.team field back to a team in the teams table without modifying thousands of lines in excel,

Re: [web2py] Initial db setup using csv import for relational tables?

2012-01-25 Thread nils
Hi, I had a similar problem, my solution was somthing like this: import csv dr = csv.DictReader(open('csvfile.csv'), delimiter=',') for data in dr: if data['team'] =='text': team = 1 or (the team id in your table) elif data['team'] =='more text': team = 2 or (the team