Best way to create multiple tables?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Best way to create multiple tables?

dboland9
I'm doing an app. that has multiple tables in sqlite.  When the app. is run for the first time, or the tables are lost/damaged, it will create the database and all tables.  My question is if there is a best way to create 5 tables?

I can put al the Python code into one function, pass the path to the database file to multiple functions, or pass the connection to multiple functions.  One function is the most contained, but very large!  Any suggestions from those that have been there done that (BTDT)?

Thanks,
Dave

Sent with [ProtonMail](https://protonmail.com) Secure Email.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Best way to create multiple tables?

Tim Streater-3
On 12 Aug 2019, at 13:51, dboland9 <[hidden email]> wrote:

> I'm doing an app. that has multiple tables in sqlite.  When the app. is run
> for the first time, or the tables are lost/damaged, it will create the
> database and all tables.  My question is if there is a best way to create 5
> tables?
>
> I can put al the Python code into one function, pass the path to the database
> file to multiple functions, or pass the connection to multiple functions.  One
> function is the most contained, but very large!  Any suggestions from those
> that have been there done that (BTDT)?

I check for the existence of each database, and if not found then create it from scratch. I also have a globals table in each database, of which one of the columns is a version number. If a new software version expects a later version number, it can apply incremental schema changes. An older software version finding a too-new version number can quit with a message asking the user to upgrade.


--
Cheers  --  Tim
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users