1
votes

I am optimizing our app engine backend RPC calls and I noticed below lines:

ndb.put_multi(list_of_emails)
ndb.put_multi(list_of_events)
ndb.put_multi(list_of_stats)

So I thought why not just do this instead:

ndb.put(list_of_emails + list_of_events + list_of_stats)

From multiple ndb.put_multi() calls down to a single call.

Although this works fine from my testing. Question: Is this a good idea to put different entities/models in a single ndb.put_multi() call?

The docs ndb.put_multi() says "it stores a sequence of Model instances." but how about a sequence of different model instances?

1

1 Answers

0
votes

I've never had any problems passing a collection of different types of entity to ndb.put_multi, so I believe this is fine. However like you, I don't see anything that explicitly confirms this in the documentation.