logo
down
shadow

Fetch large JSON from Datastore


Fetch large JSON from Datastore

By : user6066467
Date : November 28 2020, 11:01 PM
wish of those help Do you need all the entity in a single request ?
if Not, then you can batch fetch entities using Cursor Queries and display as per your need, say for eg: fetch 20 or 30 entities at a time depending on your need. If Yes, Does your meal entity changes often If No, you can generate a json file and store it in GCS, and whenever your entity changes you can update the json file, so that on the client end fetching will be lot faster and using etag header, new content can be pulled easily If Yes, then i think batch fetching is only effective way to pull those many entities
code :


Share : facebook icon twitter icon
extjs datastore send to server (datastore -> json)

extjs datastore send to server (datastore -> json)


By : Paul
Date : March 29 2020, 07:55 AM
it should still fix some issue (I can guarantee that the following applies to Ext > 2.3)
Because Ext.data.Store stores an array of Ext.data.Record objects, it has no direct access to the underlying data (Ext.data.Record encapsulates the data), so, indeed, there's no direct way to do it. But Ext.data.Record itself has a public property called "data" (an object with the field:value properties), which you can collect into an array (e.g. using the Ext.data.Store#each method) and then encode with Ext.encode() to "stringify" it.
How to properly save and fetch JSON from Datastore?

How to properly save and fetch JSON from Datastore?


By : user2777416
Date : March 29 2020, 07:55 AM
To fix the issue you can do You shouldn't need to do any encoding when inserting a 'string' (you've serialized your dictionary to a string) into the AppEngine datastore.
I tried the following code and got back the same exact same string when retrieved from the datastore.
code :
eggs_dict = {"large":10, "medium":5, "small":24}
eggs_json = simplejson.dumps(eggs_dict)
spam = Spam(key_name='blah')
spam.eggs = eggs_dict
db.put(spam.eggs)        

new_spam = db.get(db.Key.from_path('Spam', 'blah'))

# Later, fetch spam and then return the json as part of a Response
self.response.out.write(new_spam.eggs)
How to fetch the data in datastore with a key

How to fetch the data in datastore with a key


By : GomerVova
Date : March 29 2020, 07:55 AM
Hope that helps Constructing a new Entity with the given key does not fetch the entity from the datastore, it creates a new entity in memory with the same key. To get the entity, you must call datastore.get(key) (where datastore is the DatastoreService that you create with DatastoreServiceFactory.getDatastoreService()).
how to fetch name/key in from datastore

how to fetch name/key in from datastore


By : user3186116
Date : March 29 2020, 07:55 AM
I hope this helps you . Implement the KeyLoader interface to set the field during entity load.
code :
type UserDetails struct {
    NameID   string `datastore:"-"`
    Email    string `datastore:"Email"`
    UserID   string `datastore:"UserID"`
    UserName string `datastore:UserName`
}

func (ud *UserDetails) LoadKey(k *datastore.Key) error {
    ud.NameID = k.Name
    return nil
}

func (ud *UserDetails) Load(ps []datastore.Property) error {
    return datastore.LoadStruct(ud, ps)
}

func (ud *UserDetails) Save() ([]datastore.Property, error) {
    return datastore.SaveStruct(ud)
}
func (c DataStoreClient) GetUserDetailsByOrg(ctx context.Context, orgName string) ([]*UserDetails, error) {
    var userDetails []*UserDetails
    q := datastore.NewQuery(userDetailsKind).
        Namespace(orgName)
    _, err := c.client.GetAll(ctx, q, &userDetails)
    return userDetails, err
}
Datastore fetch VS fetch(keys_only=True) then get_multi

Datastore fetch VS fetch(keys_only=True) then get_multi


By : Graeme
Date : March 29 2020, 07:55 AM
I hope this helps . FWIW, you shouldn't expect meaningful results from datastore performance tests performed locally, using either the development server or the datastore emulator - they're just emulators, they don't have the same performance (or even the 100% equivalent functionality) as the real datastore.
Credit goes to @snakecharmerb, who correctly identified the culprit, confirmed by OP:
shadow
Privacy Policy - Terms - Contact Us © soohba.com