Hi Graham,

On Sun, Oct 4, 2009 at 10:25 PM, Graham Charles <[email protected]>wrote:

>
> I'm struggling with bulk uploading CSV files to related tables. I have
> foreign keys in the source data, but obviously, GAE doesn't use them.
>

You can translate foreign keys into db.Key instances, and use a
ReferenceProperty in you model for them.


> The code at
>
> http://code.google.com/appengine/docs/python/tools/uploadingdata.html
>
> Works great for one flat table at a time, but doesn't reference how to
> relate entries in a Child table to its Parent.
>

Override the generate_key method in your Loader class, and have it return a
key specifying the desired Parent.

-Nick Johnson


>
> Thanks,
>
> Graham Charles
>
> >
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

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

Reply via email to