Hi,

I wanted to ask how to load csv data into the model. What steps do we have 
to follow .

I have made this function but how exactly to run this code because, python 
manage.py loaddata wont work. 

def import_data():
with open('sample-dataset.csv') as f:
reader = csv.reader(f)
for row in reader:
if row[0] != 'user_id':
_, created = Funnel.objects.get_or_create(
user_id=row[0],
event=row[1],
timestamp=row[2],
session_id=row[3]
)


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ab4f4d9d-87b6-45e4-b490-1d665b1795can%40googlegroups.com.
  • ... 'Muhammad Asim Khaskheli' via Django developers (Contributions to Django itself)
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
    • ... Franck Tchouanga
      • ... Franck Tchouanga
    • ... Philip Mutua

Reply via email to