Nick,

> Can you clarify what you mean by 'java loader' and 'hosted mode'?

My java loader is a servlet which loads a CSV from disk, processes it and
persists entities to the datastore. The CSV has the values for the
properties I want my entity to have. The CSV and the data it points to is in
WEB-INF, so I can get away with loading large sets in hosted mode and
smaller sets in production (because  of the static file limit and request
timeout it is not possible to load all of my data in production using this
method). The Kind is created when I persist that first entity. This is
functionally similar to a python bulk loader, except it is a one-off
servlet, and does not come with all of the configuration and transport
mechanism options that provided by the python SDK.

> In the Python SDK, entities are named after the unqualified name of the
class, by default - so a 'Film' gets loaded with an entity name of 'Film'.
You can specify a custom entity type name with the kind() method. I'm still
not hugely familiar with Java, so I'm not sure under which conditions it
will use qualified and unqualified names - basically, you need to match
those with your Python loaders.

At one point I tried to convince bulkloader.py (using
--kind=package.MyClass) and my custom bulk loader
(bulkloader.Loader.__init__(self, 'package.MyClass')) to accept the full
java package name, but even when I used namespaces in the python model, this
did not work.

Perhaps a python example for the kind() method you mention? Am I correct in
assuming that I should provide a  kind() method in my custom bulk loader
which overrides the default in much the same way as handle_entity() or
generate_key() gives you a hook into those functions?

In other words, should I try this?

================================
class MyClass(db.Model):
  name = db.StringProperty()
  other_property = db.StringProperty()

class MyClass(bulkloader.Loader):
 def __init__(self):
  bulkloader.Loader.__init__(self, 'MyClass',
                [('name', str),
                ('other_property', str)
                ])

 def kind(self, entity):
  return 'package.MyClass'
================================


I understand if you can't provide a Java example, no worries. In lieu of
that, could you provide a full example of customizing the python model's
namespace using the kind() method in a custom bulkloader, along with the
command line syntax to push it (with appcfg.py using the custom loader). And
if that's not enough <grin> it would be good to see the query syntax in the
runtime application (e.g. "SELECT * from package.MyName" with the right
python import statements).

Thanks for your help on this.

Stuart

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

Reply via email to