[google-appengine] Re: Bulkloader and Preserving Key_Names

2009-05-19 Thread Nick Johnson (Google)

On Tue, May 19, 2009 at 3:51 PM, Devel63  wrote:
>
> Thanks very much for the helpful info.  Generate_key is a great find,
> and it's useful to know that we should waste out time trying to export
> key_names at this time.
>
> As for preserving reference links, do we need to create a translation
> table [entity type, old_key, new_key] and do writes to the table as we
> upload each entity, and reads to determine new reference value as we
> upload references?

If you're using numeric IDs then yes, that is probably your best bet.

-Nick Johnson

>
> Or is there some, more built-in way to handle this?
>
> On May 18, 5:10 am, "Nick Johnson (Google)" 
> wrote:
>> Hi Dan,
>>
>> On Sun, May 17, 2009 at 1:24 AM, Devel63  wrote:
>>
>> > Is there some way to export key_names and then later import them using
>> > the bulkloader?
>>
>> Unfortunately, the exporter code doesn't provide any easy way to
>> export key names. Your best bet is probably to extend output_entities,
>> which I agree is not ideal.
>>
>>
>>
>> > I've seen the examples from folks messing around with Handle_Entity,
>> > but that seems pretty kludgy (and dangerous, given that this is inside
>> > the source, and changed last release).
>>
>> If you just want to determine the key name, you can override
>> generate_key:http://code.google.com/p/googleappengine/source/browse/trunk/python/g...
>> . Overriding handle_entity is explicitly encouraged, though - as the
>> docstring states: "Subclasses can override this to add custom entity
>> conversion code.".
>>
>>
>>
>> > And key_name aside, what about preserving Reference links in general.
>> > How is that done?
>>
>> You can write a function to modify it on download, or on upload -
>> whatever works best for your particular situation.
>>
>> -Nick Johnson
> 

--~--~-~--~~~---~--~~
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: Bulkloader and Preserving Key_Names

2009-05-19 Thread Devel63

Thanks very much for the helpful info.  Generate_key is a great find,
and it's useful to know that we should waste out time trying to export
key_names at this time.

As for preserving reference links, do we need to create a translation
table [entity type, old_key, new_key] and do writes to the table as we
upload each entity, and reads to determine new reference value as we
upload references?

Or is there some, more built-in way to handle this?

On May 18, 5:10 am, "Nick Johnson (Google)" 
wrote:
> Hi Dan,
>
> On Sun, May 17, 2009 at 1:24 AM, Devel63  wrote:
>
> > Is there some way to export key_names and then later import them using
> > the bulkloader?
>
> Unfortunately, the exporter code doesn't provide any easy way to
> export key names. Your best bet is probably to extend output_entities,
> which I agree is not ideal.
>
>
>
> > I've seen the examples from folks messing around with Handle_Entity,
> > but that seems pretty kludgy (and dangerous, given that this is inside
> > the source, and changed last release).
>
> If you just want to determine the key name, you can override
> generate_key:http://code.google.com/p/googleappengine/source/browse/trunk/python/g...
> . Overriding handle_entity is explicitly encouraged, though - as the
> docstring states: "Subclasses can override this to add custom entity
> conversion code.".
>
>
>
> > And key_name aside, what about preserving Reference links in general.
> > How is that done?
>
> You can write a function to modify it on download, or on upload -
> whatever works best for your particular situation.
>
> -Nick Johnson
--~--~-~--~~~---~--~~
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: Bulkloader and Preserving Key_Names

2009-05-18 Thread Nick Johnson (Google)

Hi Dan,


On Sun, May 17, 2009 at 1:24 AM, Devel63  wrote:
>
> Is there some way to export key_names and then later import them using
> the bulkloader?

Unfortunately, the exporter code doesn't provide any easy way to
export key names. Your best bet is probably to extend output_entities,
which I agree is not ideal.

>
> I've seen the examples from folks messing around with Handle_Entity,
> but that seems pretty kludgy (and dangerous, given that this is inside
> the source, and changed last release).

If you just want to determine the key name, you can override
generate_key: 
http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/bulkloader.py#3215
. Overriding handle_entity is explicitly encouraged, though - as the
docstring states: "Subclasses can override this to add custom entity
conversion code.".

>
> And key_name aside, what about preserving Reference links in general.
> How is that done?

You can write a function to modify it on download, or on upload -
whatever works best for your particular situation.

-Nick Johnson

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