> > The API could always be extended, without breaking compatibility:
>
> > ids = db.test.insert([dict(title='foo'),dict(title='bar')])
>
> Does it buy us speed or just compact notation?
> Because we would be spending additional time checking the type of the
> input.

The batch operations execute in parallel so the speedup would be
proportional to the number of items.

Batch get/put/delete were added after the driver was written, and
since I have not really needed them, but anyone could easily add
them.

Maybe someone could add batch operations to gql.py and add any other
features they need.

Robin

On Sep 27, 10:51 pm, mdipierro <[email protected]> wrote:
> On Sep 27, 9:50 pm, Robin B <[email protected]> wrote:
>
> > > exactly. To get optimized code on both platforms I currently need to
> > > use:
>
> > > if request.env.web2py_runtime_gae:
> > >     records = [db.test[id] for id in test_ids]
> > > else:
> > >     records = db(db.test.id.belongs(test_ids)).select()
>
> > > So what I am suggesting is the DAL support "belongs" for GAE by doing
> > > this behind the scenes, to make web2py apps more backend agnostic.
>
> > You are absolutely right, it can be done, but no one has implemented
> > it.
>
> I would accept on this from Robin without thinking twice
>
>
>
>
>
> > Here is a short list of things that would be useful:
>
> > -batch get/put/delete
> > -simple transaction interface
> > -query/sort by __key__
> > -list properties
> > -key only queries
>
> > Some were not available when the driver was created, and as far as I
> > know they are not implemented in the DAL.
>
> > Also if you want to make common entity groups for transactions, you
> > have to use the AppEngine Models to set the parent entity, web2py only
> > tracks IDs, not parents/Keys.
>
> > > Neat. But multiple record get/update/delete are already supported. And
> > > I guess multiple record insert wouldn't fit with the current API.
>
> > The API could always be extended, without breaking compatibility:
>
> > ids = db.test.insert([dict(title='foo'),dict(title='bar')])
>
> Does it buy us speed or just compact notation?
> Because we would be spending additional time checking the type of the
> input.
>
> > Robin
>
> > On Sep 27, 7:28 pm, Richard <[email protected]> wrote:
>
> > > > > for a standard database (eg postgres) "belongs" would be faster,
> > > > > right? Because I am using this same code for both GAE and a Linux box.
>
> > > > Yes a relational database can do this in 1 query, GAE would require N
> > > > queries or 1 batch get by id.
>
> > > exactly. To get optimized code on both platforms I currently need to
> > > use:
>
> > > if request.env.web2py_runtime_gae:
> > >     records = [db.test[id] for id in test_ids]
> > > else:
> > >     records = db(db.test.id.belongs(test_ids)).select()
>
> > > So what I am suggesting is the DAL support "belongs" for GAE by doing
> > > this behind the scenes, to make web2py apps more backend agnostic.
>
> > > > > insert/update is already supported on GAE, so what would get/put add?
>
> > > > Using batch get/put/delete would allow selecting, inserting/updating,
> > > > and deleting of multiple records (up to 500) with a single database
> > > > request rather than 500 requests.
>
> > > Neat. But multiple record get/update/delete are already supported. And
> > > I guess multiple record insert wouldn't fit with the current API.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to