piccolo-orm / piccolo

A fast, user friendly ORM and query builder which supports asyncio.
https://piccolo-orm.com/
MIT License
1.32k stars 86 forks source link

Is there a way to truncate the table? #1009

Open devsarvesh92 opened 3 weeks ago

dantownsend commented 3 weeks ago

Piccolo doesn't have a truncate command built in at the moment - you can use delete:

await MyTable.delete(force=True)

Or raw SQL to access the truncate command:

await MyTable.raw('TRUNCATE my_table')
dantownsend commented 3 weeks ago

I'll probably add this when I get time, as I do think would be nice.

Sometimes along the lines of this:

https://github.com/piccolo-orm/piccolo/blob/9d1ab2d492c26a677d689823f85d12303f548bfa/piccolo/table.py#L1449

sarvesh-deserve commented 3 weeks ago

Thanks @dantownsend