Skip to content

Instantly share code, notes, and snippets.

@wyattdanger
Created March 6, 2010 15:08
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 wyattdanger/323728 to your computer and use it in GitHub Desktop.
Save wyattdanger/323728 to your computer and use it in GitHub Desktop.
def main():
import csv, sys, re
from pykk.message import site, db
from yourapp.apps.models import YourModel # import your relevant models
db.initialize()
reader = csv.DictReader(open(sys.argv[1]))
with db.transaction('Importing Employees'):
for row in reader:
# Go to town here
# To access a table row: row['Name of row']
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment