On Sat, Oct 14, 2017 at 12:41 PM, boB Stepp <robertvst...@gmail.com> wrote: > py3: c.executescript(sql) > <sqlite3.Cursor object at 0x00000000026B4490> > py3: tb_exists = "select name from sqlite_master where type='table' > and name='BloodPressureReadings'" > py3: tb_ck = c.execute(tb_exists).fetchone() > py3: print(tb_ck) > ('BloodPressureReadings',) > > So it is looking like I can use this technique to determine if I need > to create the BloodPressureReadings table or not. Am I on track here > or is there a better technique? >
awesome trick. but most of the time applications had to exported out of sqlite to either mysql or postgresql at which time it would be a lot of refactoring as this trick uses sqlite internals to check if a table exists. fetchone would always return a tuple as we did count in the sql instruction. so it would be easier to embed in an if statement. Regards Srinivas Devaki Software Developer at Zomato, New Delhi Phone: +91 9491 383 249 Telegram: @eightnoteight _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor