[Tutor] How to test for the existence of a table in a sqlite3 db?

Albert-Jan Roskam sjeik_appie at hotmail.com
Wed Oct 18 16:09:31 EDT 2017


On Oct 16, 2017 15:12, Neil Cerutti <neilc at norwich.edu> wrote:
>
> On 2017-10-15, boB Stepp <robertvstepp at gmail.com> wrote:
> > Some things I am still pondering:
> >
> > 1)  If I adopt the incremental approach to creating and
> > initializing the working db, then it seems that the list,
> > "sql_scripts", should not be hard-coded into the program.  It
> > seems to me it should be off somewhere by itself with perhaps
> > other things that might evolve/change over time in its own file
> > where it (and its brethren) are easy to locate and update.
>
> An incremental approach is not recommended if you are using the
> sqlite3 module. In sqlite modifying table definitions is limited
> to the simple addition of a new row of data. Any other change
> requires you to create a new table, copy the old data into it,
> and then drop the old table.

Really? How so? I used ALTER TABLE ADD COLUMN the other day, which is part of this SQL dialect: https://sqlite.org/lang_altertable.html


More information about the Tutor mailing list