Choosing correct datastore_types using bulkloader

2 views
Skip to first unread message

tijer

unread,
Apr 19, 2008, 2:15:21 PM4/19/08
to Google App Engine
Hi, I'm having some issues with using the bulkloader.

I'm having issues with getting the data in the datastore appear as the
correct datatypes. I'm using a model with both a (google) user, and a
datetime object.

Currently, my bulkloader looks like this:

bulkload.Loader.__init__(self, 'Post',
[('author', datastore_types.Email), # problem
here, Email is not the same as User
('date', str), # problem here, converts to
string, but datetime does not help
('content', datastore_types.Text)
])


I would like the author to be a user object, and the date to translate
into a date object (currently it is has the format of (ex) "2006-11-13
19:02:00").

However, I am not having much luck with finding the correct datatype
for a user object when using the bulkloader, and the same goes for
finding the correct type for a date.

Any thoughts?

Victor Kryukov

unread,
Apr 19, 2008, 4:54:12 PM4/19/08
to Google App Engine
On Apr 19, 1:15 pm, tijer <troels...@gmail.com> wrote:
> Hi, I'm having some issues with using the bulkloader.
>
> I'm having issues with getting the data in the datastore appear as the
> correct datatypes. I'm using a model with both a (google) user, and a
> datetime object.

There is good documentation for bulkload.Loader (and for other parts
or bulkload). To see it, visit

http://localhost:8080/_ah/admin/interactive

and type

from google.appengine.ext import bulkload
print help(bulkload.Loader)

in the textare and press RunProgram. In particular, you can change
('date', str) above to
('date', lambda x: datetime.datetime.strptime(x, '%Y-%m-%d %h:%M:%s')

Hope that helps,
Victor.
Reply all
Reply to author
Forward
0 new messages