I am trying to do a bulk load from csv with one of the fields being a
date.  But i am getting the following error:
BadValueError: Unsupported type for property scheduled_date: <type
'datetime.date'>

Here is my loader file.  Any help will be appreciated!

import datetime
from google.appengine.ext import bulkload
from google.appengine.api import datastore_types
from google.appengine.ext import search

class WOLoader(bulkload.Loader):
  def __init__(self):
        bulkload.Loader.__init__(self, 'Work_Order',
                         [('row_no', int),
                          ('type', str),
                          ('status', str),
                          ('scheduled_date', lambda x: 
datetime.datetime.strptime(x, '%m/%d/
%Y').date()),
                          ('customer_name', str),
                          ('contractor_name', str),
                          ('address', datastore_types.PostalAddress),
                          ('door_size_type', datastore_types.Text),
                          ('door_color', str)
                          ])

  def convertToDate(self, x):
    print x
    return datetime.datetime.strptime(x, '%m/%d/%Y').date()


  def HandleEntity(self, entity):
    ent = search.SearchableEntity(entity)
    return ent

class TechLoader(bulkload.Loader):
  def __init__(self):
        bulkload.Loader.__init__(self, 'Work_Order',
                         [('work_order', str),
                          ('tech_name', str)
                          ])

  def HandleEntity(self, entity):
    print entity.row_no+"\n"
    return entity


class PhoneLoader(bulkload.Loader):
  def __init__(self):
        bulkload.Loader.__init__(self, 'Work_Order',
                         [('work_order', str),
                          ('phone_type', str),
                          ('number', str)
                          ])

  def HandleEntity(self, entity):
    ent = search.SearchableEntity(entity)
    return ent


if __name__ == '__main__':
  bulkload.main(WOLoader())

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to