[Tutor] Is it possible to archive subsets of data from an SQLite db and restore it later?

Zachary Ware zachary.ware+pytut at gmail.com
Tue Aug 18 05:51:12 CEST 2015

On Mon, Aug 17, 2015 at 10:44 PM, boB Stepp <robertvstepp at gmail.com> wrote:
> My wife had an interesting request tonight:  Would it be possible to
> have two dbs, one that is the current working db, and the other an
> archival db for students who have left the school?  If yes, then the
> archival db would need to be able to serve two functions:
> 1) If the teacher gets a request for certain types of reports, then
> she should be able to generate them from the archival db just as she
> would be able to from her working db.  She would want the archival db
> to retain the same structure and functionality as the current working
> db.
> 2) If a student returns to the school as a student, it should be
> possible to reintegrate all of that student's data from the archival
> db back into the current working db.
> I see this more as an interesting problem right now as I think it
> would take a long time to fill up SQLite's 2 TB max size.  It seems to
> me like it should be doable, but might be quite complicated.  OTH, I
> don't know much about SQL yet, and it might actually be more trivial
> than I can currently imagine.  So I thought I would ask the group to
> see which category of problem this truly is.

i think rather than try to move data between two DBs, I'd just add a
Boolean 'currently_enrolled' column to the Students table.  When you
care about whether the student is currently enrolled or not, add
'WHERE currently_enrolled = true' (or however that needs to be
spelled) to your query.  When the student graduates/moves/re-enrolls,
just update that value.

I'm not hugely experienced with databases/SQL myself either, though.


More information about the Tutor mailing list