[Tutor] How is database creation normally handled?

leam hall leamhall at gmail.com
Sat Sep 9 20:48:34 EDT 2017


On Sat, Sep 9, 2017 at 8:29 PM, boB Stepp <robertvstepp at gmail.com> wrote:

> While reading about SQL, SQLite and the Python module sqlite3, it
> appears that I could (1) have a program check for the existence of the
> program's database, and if not found, create it, make the tables,
> etc.; or, (2) create the database separately and include it with the
> program.  What are the pros and cons of each approach?  (1) to me
> looks only helpful if I wish to write a program that might want to
> allow the user to have multiple databases.  But this sounds like a lot
> of extra coding and checking to make it work well.  But if I only wish
> to have a single database, then (2) sounds like the approach to use.
> I would create the database, populate it with the needed empty tables
> with the desired fields, making it ready to use by the program's user.
>
> Not having any experience in the database arena, I'm not even sure I
> know how to properly think about this.
>


I'd write a configure script separate to set things up. It only gets run
when needed and you can change the process if you want to move from SQLite3
to MongoDB or whatever. It also lets the user set up test databases.


More information about the Tutor mailing list