Ticket #479 (closed enhancement: fixed)

Opened 13 months ago

Last modified 13 months ago

GAE Adapter improvements

Reported by: nick Owned by: nick
Priority: blocker Milestone: 0.4.1
Component: Adapter Version: 0.4
Keywords: gae Cc:
Fixed in revision: Branch:
Author:

Description

As it stands the GAE adapter fetches each instance from the datastore if the KEY_ATTR attribute is supplied with the encoded instance. This happens even if the object has been fetched before, incurring a get request. This is obviously stupid; an index on the encoder's context should be created and consulted before fetching from the datastore.

When encoding objects PyAMF follows db.ReferenceProperty attributes (as it should) however, to encode the object, it is first fetched from the datastore (all fine so far). The 'problem' occurs when say a number of Novel objects have a reference to the same Author object. PyAMF will fetch the Author object from the datastore each time it is encountered. We could use the same context index to see if the instance has already been fetched.

Change History

  Changed 13 months ago by nick

  • status changed from new to accepted

follow-up: ↓ 3   Changed 13 months ago by thijs

  • status changed from accepted to assigned
  1. GAEReferenceCollection needs an @since
  2. Datastore in GAEReferenceCollection needs an C{}
  3. getGAEObjects needs a docstring and @since
  4. loadInstanceFromDatastore's params could use some @param's
  5. writeGAEObject needs an @since
  6. the word Encoder in install_gae_reference_model_hook needs an L{}
  7. the line below doesn't need the '..', either remove them or give a better explanation:
    # the dev_appserver freaks out if you have pyc, pyo in here .. 
    
  8. the stuff in r2164 needs to be enclosed in C{} completely imo, like:

C{object.__class__: {key1: object1, key2: object2, .., keyn: objectn]}

in reply to: ↑ 2   Changed 13 months ago by nick

  • status changed from assigned to accepted

Addressed review comments in branch.

  Changed 13 months ago by nick

  • status changed from accepted to closed
  • resolution set to fixed

Merged in r2203.

Note: See TracTickets for help on using tickets.