Skip to content

Instantly share code, notes, and snippets.

@FlaviuSim
Created February 27, 2012 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlaviuSim/1927960 to your computer and use it in GitHub Desktop.
Save FlaviuSim/1927960 to your computer and use it in GitHub Desktop.
import csv
from myproject.main.models import Drug
def load_drugs(file_path):
"this loads the drugs from pipe delimited to my model"
reader = csv.reader(open(file_path), delimiter="|")
reader.next() # skip header row
for row in reader:
drug = Drug(rxcui=row[0], short_name=row[1], is_brand=row[2])
drug.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment