fork download
  1. # -*- coding: utf-8 -*-
  2.  
  3. from mongoengine import *
  4.  
  5.  
  6. class Report(Document):
  7. name = StringField()
  8. email = StringField()
  9. num_orders = StringField()
  10. num_products = StringField()
  11. total = StringField()
  12.  
  13. import csv
  14. with open('report_result.csv', 'w') as csvfile:
  15. connect('order_report_base')
  16. spamwriter = csv.writer(csvfile)
  17. for report in Report.objects:
  18. spamwriter.writerow([report.name] + [report.email] + [report.num_orders] + [report.num_products] + [report.total])
Runtime error #stdin #stdout #stderr 0.03s 44680KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 75, in run_toplevel
  File "prog.py", line 3, in <module>
    from mongoengine import *
ImportError: No module named mongoengine