[google-appengine] Re: Problem for bulkloader.py using PolyModel

2009-03-13 Thread Marzia Niccolai
Hi,

Can you also post the code from the handler?

Thanks,
Marzia

On Thu, Mar 12, 2009 at 8:30 PM, Webysther  wrote:

>
> 1.Create entity
>
> class Contact(polymodel.PolyModel):
>  phone_number = db.PhoneNumberProperty()
>  address = db.PostalAddressProperty()
>
> Upload data...
>
> 2.Create entity
>
> class Person(Contact):
>  first_name = db.StringProperty()
>  last_name = db.StringProperty()
>  mobile_number = db.PhoneNumberProperty()
>
> Upload data, opss!!! Error...
>
> Traceback (most recent call last):
>  File "C:\Program Files (x86)\Google\google_appengine\bulkloader.py",
> line
> 60, in 
>run_file(__file__, globals())
>  File "C:\Program Files (x86)\Google\google_appengine\bulkloader.py",
> line
> 57, in run_file
>execfile(script_path, globals_)
>  File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
> line
> 2588, in 
>sys.exit(main(sys.argv))
>  File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
> line
> 2584, in main
>auth_domain=auth_domain)
>  File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
> line
> 2467, in _PerformBulkload
>LoadConfig(config_file)
>  File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
> line
> 2376, in LoadConfig
>Loader.RegisterLoader(cls())
>  File "H:\projects\ibge\import\uf.py", line 10, in __init__
>('co_regiao', int)
>  File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
> line
> 1880, in __init__
>db.class_for_kind(kind)
>  File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\ext\db\__init__.py",
> line
> 217, in class_for_kind
>raise KindError('No implementation for kind \'%s\'' % kind)
> google.appengine.ext.db.KindError: No implementation for kind 'Person'
>
> http://code.google.com/p/googleappengine/issues/detail?id=1133
>
> Ideas?
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[google-appengine] Re: Problem for bulkloader.py using PolyModel

2009-03-16 Thread Saravana

Marzia,

The problem is occurs when data for  a class that is derived from a
class that is derived from polymodel class.

The problem is bulkloader looks for the class in _kind_map[1], but it
is not available in _kind_map.  See comment[2] in polymodel class, why
subclasses are not added to _kind_map,

 Unless the class is a root class or PolyModel itself, it is not
inserted in to the kind-map like other models.  However, all polymorphic
classes, are inserted in to the class-map which maps the class-key to
implementation.  This class key is consulted using the polymorphic instances
discriminator (the 'class' property of the entity) when loading from the
datastore.

Hope this helps in understanding the issue.

[1] 
http://code.google.com/p/googleappengine/source/browse/trunk/google/appengine/ext/db/__init__.py#215
[2] 
http://code.google.com/p/googleappengine/source/browse/trunk/google/appengine/ext/db/polymodel.py#103

Thanks
Saravana


On Fri, Mar 13, 2009 at 3:00 PM, Marzia Niccolai  wrote:
>
> Hi,
>
> Can you also post the code from the handler?
>
> Thanks,
> Marzia
>
> On Thu, Mar 12, 2009 at 8:30 PM, Webysther  wrote:
>>
>> 1.Create entity
>>
>> class Contact(polymodel.PolyModel):
>>  phone_number = db.PhoneNumberProperty()
>>  address = db.PostalAddressProperty()
>>
>> Upload data...
>>
>> 2.Create entity
>>
>> class Person(Contact):
>>  first_name = db.StringProperty()
>>  last_name = db.StringProperty()
>>  mobile_number = db.PhoneNumberProperty()
>>
>> Upload data, opss!!! Error...
>>
>> Traceback (most recent call last):
>>  File "C:\Program Files (x86)\Google\google_appengine\bulkloader.py",
>> line
>> 60, in 
>>    run_file(__file__, globals())
>>  File "C:\Program Files (x86)\Google\google_appengine\bulkloader.py",
>> line
>> 57, in run_file
>>    execfile(script_path, globals_)
>>  File "C:\Program Files
>> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
>> line
>> 2588, in 
>>    sys.exit(main(sys.argv))
>>  File "C:\Program Files
>> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
>> line
>> 2584, in main
>>    auth_domain=auth_domain)
>>  File "C:\Program Files
>> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
>> line
>> 2467, in _PerformBulkload
>>    LoadConfig(config_file)
>>  File "C:\Program Files
>> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
>> line
>> 2376, in LoadConfig
>>    Loader.RegisterLoader(cls())
>>  File "H:\projects\ibge\import\uf.py", line 10, in __init__
>>    ('co_regiao', int)
>>  File "C:\Program Files
>> (x86)\Google\google_appengine\google\appengine\tools\bulkloader.py",
>> line
>> 1880, in __init__
>>    db.class_for_kind(kind)
>>  File "C:\Program Files
>> (x86)\Google\google_appengine\google\appengine\ext\db\__init__.py",
>> line
>> 217, in class_for_kind
>>    raise KindError('No implementation for kind \'%s\'' % kind)
>> google.appengine.ext.db.KindError: No implementation for kind 'Person'
>>
>> http://code.google.com/p/googleappengine/issues/detail?id=1133
>>
>> Ideas?
>>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---