Re: [web2py] Deleting a db table row

2018-07-24 Thread Maurice Waka
This works well. I guess I failed to clarify: 2. Is there a way of following this example but deleting rows upto a certain limit, say anything above 50 like in this example:... Should have been retain latest inputs up a certain limit e.g. the last 50, and delete older inputs. I got a better

Re: [web2py] Deleting a db table row

2018-07-22 Thread Anthony
On Sunday, July 22, 2018 at 7:13:13 AM UTC-4, Maurice Waka wrote: > > I have tried this example but I get this error below: > > > db(query).delete() > > Show the code for "query". Looks like it might include a Set object where a field or value is expected. > DELETE FROM post WHERE id IN(SELECT

Re: [web2py] Deleting a db table row

2018-07-22 Thread Maurice Waka
Sorry. I got it. Regards On Sun, 22 Jul 2018, 14:33 sandeep patel wrote: > You can delete row this way!! > db((db.table.id==id_s)&(db.table.created_by == auth.user.id)).delete() > if you want delete rows upto a certain limit so you can you put this > quarry under for loop. > Best, > > On Sun,

Re: [web2py] Deleting a db table row

2018-07-22 Thread Maurice Waka
What's id_s? Am getting error that id_s not defined On Sun, 22 Jul 2018, 14:33 sandeep patel wrote: > You can delete row this way!! > db((db.table.id==id_s)&(db.table.created_by == auth.user.id)).delete() > if you want delete rows upto a certain limit so you can you put this > quarry under for

Re: [web2py] Deleting a db table row

2018-07-22 Thread sandeep patel
You can delete row this way!! db((db.table.id==id_s)&(db.table.created_by == auth.user.id)).delete() if you want delete rows upto a certain limit so you can you put this quarry under for loop. Best, On Sun, Jul 22, 2018 at 4:43 PM Maurice Waka wrote: > I have tried this example but I get this

Re: [web2py] Deleting a db table row

2018-07-22 Thread Maurice Waka
I have tried this example but I get this error below: db(query).delete() File "/usr/local/lib/python2.7/dist-packages/pydal/objects.py", line 2277, in delete ret = db._adapter.delete(table, self.query) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/sqlite.py", line 86, in

Re: [web2py] Deleting a db table row

2017-10-14 Thread 黄祥
think you can do it by store the user created id (auth.signature or code it by your self) in your table and use it as a condition *e.g. not tested* query = ((db.table.id == id) & (db.table.created_by == auth.user_id) ) db(query).delete() best regards, stifan > -- Resources: -

Re: [web2py] Deleting a db table row

2017-10-14 Thread Maurice Waka
Hi. I happened to have the same issue as this: Specifically (syntax-wise) how does one delete a specific table row, but INDEPENDENT of the ".id" field? for example, lets say that I have the following rows in a database table: bid.idbid.bid_id 1LJWI 2LJWJ 3LJWK 4

[web2py] Deleting a db table row

2010-02-10 Thread Auden RovelleQuartz
I hope this is a simple question: Specifically (syntax-wise) how does one delete a specific table row, but INDEPENDENT of the .id field? for example, lets say that I have the following rows in a database table: bid.id bid.bid_id 1 LJWI 2 LJWJ 3 LJWK 4 LJWL I know that

Re: [web2py] Deleting a db table row

2010-02-10 Thread Thadeus Burgess
rows = db(db.bid.id 0).select(limitby=(1, 2), orderby=db.bid.id) rows.first().delete_record() Test that out a bit see if it does what you want. -Thadeus On Wed, Feb 10, 2010 at 10:59 AM, Auden RovelleQuartz oves@gmail.com wrote: I hope this is a simple question: Specifically

Re: [web2py] Deleting a db table row

2010-02-10 Thread Thadeus Burgess
This does delete the row from the actual database table acts on the database row.delete_record() row.update_reocrd() works on the recordset. row.delete() row.update() This is because delete() and update() are python builtin dict functions, that is why it uses this naming scheme. -Thadeus

Re: [web2py] Deleting a db table row

2010-02-10 Thread Thadeus Burgess
A Rows object is just an array with database specific operations added. So you can go rows = db(db.table.id 0).select() rows[n].delete_record() if you know what (n) is. first() syntax has been added since the manual was published. However, it is just a shortcut to the following, but returns