After i have removed some log entries in a SQLite DB, I found that the database file size stay the same. This is because SQLite will keep the used space and reuse them later.
We can use the VACUUM command to release the empty space.
Assume the table has a column called CREATED_DATE which stores the creation date. The following SQL make use of the DATEADD() function to select records which are created within the recent 10 days.
SELECT
*
FROM
<YOUR TABLE>
WHERE
CREATED_DATE > DATEADD(day, -10, getdate())
We can use different unit in the datepart (The first argument in DATEADD()) as stated in the 2nd reference link below.
We can easily scaffold the persisted objects list, add and delete pages on Django Admin by registering your model in your app admin.py file. For example, an app named eureka with model Person.
eureka/models.py
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=256)
homepage = models.URLField(max_length=256)
def __unicode__(self):
return self.name
eureka/admin.py
from django.contrib import admin
from eureka.models import Person
admin.site.register(Person)