pythonsqlitetortoise-orm

Python 3.x Tortoise-orm Delete all values inside the database SQLite


So I've recently starting learning about tortoise-orm. But I have a question: How would I get all the data inside the SQLite database and delete all of them?

Ex Model:

from tortoise.models import Model
from tortoise import fields

class Counter(Model):
    count = fields.IntField()

    def __str__(self):
        return self.name

Solution

  • you can :

    BEWARE OF DROPPING THE DATABSE, YOU WILL LOSE ALL YOU DATA

    Tries to drop all databases provided in config passed to .init() method. Normally should be used only for testing purposes.