What is the proper way to truncate a table from appadmin?

49 views
Skip to first unread message

JoeCodeswell

unread,
Jul 12, 2014, 11:51:58 AM7/12/14
to web...@googlegroups.com
Dear web2py-users,

What is the proper way to truncate table from appadmin?

The following does a truncate but shows errors in response.flash.

In https:// ...appadmin/select/db?query=db.trip.id%3E0
Query:        <i make this blank then after i click submit it comes back  == 'db.trip.id>0'>   
Update: [x] db.trip.truncate()
Delete: [ ]

RESULT:
    db.trip is truncated
    response.flash:
        Invalid Query
        'NoneType' object is not iterable


Thanks for the help.

Love and peace,

Joe

Anthony

unread,
Jul 12, 2014, 3:15:20 PM7/12/14
to web...@googlegroups.com
Put db.trip.id > 0 in the query and check the delete box.

Anthony

JoeCodeswell

unread,
Jul 14, 2014, 1:19:00 PM7/14/14
to web...@googlegroups.com

Dear Anthony,

Thanks for your reply. Your suggestion didn't work.

TEST
1. I had trip id's numbered [1, 75] in the trip table.
2. I did your suggestion:
    - Put db.trip.id > 0 in the query
    - check the delete box.
    - [hit submit]
3. I imported from csv file trip id's numbered [1, 75].
RESULT:
    - data uploaded
    - trip id's numbered [76, 150] (please see screenshot).
   
Any ideas?
   
Thanks again, Anthony.

Love and peace,

Joe  

Anthony

unread,
Jul 14, 2014, 1:50:41 PM7/14/14
to web...@googlegroups.com
I see -- you want to reset the ID's to start at 1 again. I don't think you can do that from appadmin. Use the shell.

Anthony

JoeCodeswell

unread,
Jul 14, 2014, 11:15:37 PM7/14/14
to web...@googlegroups.com
Dear Anthony,

Thanks for the reply.

You said, "I see -- you want to reset the ID's to start at 1 again."

Yes. I believe that's what is meant by web2py’s usage of the term "truncate". I have used the shell to do that, however I would prefer to not go back and forth from appadmin to the shell.

Anyway, thanks again, Anthony. Your replies are always a blessing.

Love and peace.

Joe
Reply all
Reply to author
Forward
0 new messages