Actually I did. It took some messing about, but I post my solution
below so maybe it will help you:

Let us know how you solve it, and good luck.

class CainIncident:
    name = db.StringProperty()
    created = db.DateTimeProperty(auto_now_add=True)

class CainLoader(bulkloader.Loader):

    elements = [
        ('name', str),
    ]

    def __init__(self):
        bulkloader.Loader.__init__(self, 'CainIncident',
self.elements)

    def get_data(self):
        '''returns an array of hashes like { 'name': 'Some Name'}'''
        return [
            { 'name': 'Some Name'},
            { 'name': 'Some Other Name'},
        ]

    def generate_records(self, filename):
        data = self.get_data()

        for record in data:
            yield [
                record['name'],
            ]

loaders = [CainLoader]

On Oct 18, 12:19 am, Walter <jeb...@gmail.com> wrote:
> Did you ever figure out what the problem was?  I am being blocked by
> the same issue.
>
> Thanks,
> Walter
>
> On Sep 19, 2:14 am, Col Wilson <col.wilson.em...@googlemail.com>
> wrote:
>
>
>
> > I'm using Python 2.5 locally and GAE 1.5.
>
> > I'm trying to load data which is not is CSV format. Here's a
> > simplified model which reflects what I get with a more complex real
> > life issue:
>
> > class Thing(db.Model):
> >     name = db.StringProperty()
>
> > class ThingLoader(bulkloader.Loader):
> >     elements = [
> >         ('name', str)
> >     ]
>
> >     def __init__(self):
> >         bulkloader.Loader.__init__(self, 'Thing', self.elements)
>
> >     def generate_records(self, filename):
> >         records = load_records_from_some_datasource()
> >         for record in records:
> >             yield [
> >                 record['name']
> >             ]
>
> > loaders = [Thing]
>
> > When I try to bulkload this (both locally or to google) I get:
>
> > InternalError: Put accepted 10 entities but returned 0 keys.
>
> > I can't work out why the datastore will not allocate keys. Any ideas
> > what I should do?
--~--~---------~--~----~------------~-------~--~----~
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