You have to convert the string to datetime.datetime first
('LastUsed', lambda x: datetime.datetime.strptime(x, '%Y-%m-%d')),
adjust the format string according to your date-time string

2008/12/27 RAJ <nrwor...@gmail.com>:
>
> Hi,
>
> I am trying to upload a csv file in datastore, and I think the
> following error is coming because I am trying to use DateTimeProperty
> in it. The CSV file is having just one line of data-
>
> 0,"12/25/2008 12:00:00"
>
> Please help me.
>
> -------------- Error Trace --------------------
> INFO     2008-12-27 19:00:18,530 bulkload_client.py] Starting import;
> maximum 10
>  entities per post
> INFO     2008-12-27 19:00:18,530 bulkload_client.py] Importing 1
> entities in 23
> bytes
> ERROR    2008-12-27 19:00:19,608 bulkload_client.py] An error occurred
> while imp
> orting: Received code 400: Bad Request
>
> Loading from line 1...error:
> Traceback (most recent call last):
>  File "D:\Program Files\Google\google_appengine\google\appengine\ext
> \bulkload\_
> _init__.py", line 376, in LoadEntities
>    new_entities = loader.CreateEntity(columns, key_name=key_name)
>  File "D:\Program Files\Google\google_appengine\google\appengine\ext
> \bulkload\_
> _init__.py", line 233, in CreateEntity
>    entity[name] = converter(val)
> TypeError: function takes at least 3 arguments (1 given)
>
> ERROR    2008-12-27 19:00:19,625 bulkload_client.py] Import failed
> -------------------------------------------------
>
>
> The code in my datauploader.py is
> ------------ Code ------------------------------
> from google.appengine.ext import bulkload
> from google.appengine.api import datastore_types
> from google.appengine.ext import search
>
> class DataLoader(bulkload.Loader):
>  def __init__(self):
>    # Our 'Person' entity contains a name string and an email
>    bulkload.Loader.__init__(self, 'CountData',
>                         [('UserId', db.IntegerProperty()),
>                          ('LastUsed', db.DateTimeProperty()),
>                          ])
>
> if __name__ == '__main__':
>  bulkload.main(DataLoader())
> ----------------------------------------------------------------------------
> >
>

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

Reply via email to