|
Re: .dump command of sqlite: msg#00022python.db.pysqlite.user
The way that I do it is rather primative, but works like a charm, all I do is try and select against the table, and catch the sqlite.DatabaseError exception, then create the table in the except clause; here is some sample code: def createMusicTypeTable(self): try: cur.execute('SELECT * from MusicType') except sqlite.DatabaseError: columnNames = ('MusicType', \ 'ID', \ 'Description', \ 'Active') cur.execute('CREATE TABLE %s \ (%s INTEGER PRIMARY KEY, \ %s VARCHAR(50), \ %s INTEGER)', columnNames) self.logger.info('Created MusicType Table') Thanks, Greg Givler Information Technology Lockwood® 10 Valley Stream Parkway Malvern, PA 19355 Phone: (484) 605-4826 Email: ggivler-zdgUFu1MqnQ@xxxxxxxxxxxxxxxx David Pratt <fairwinds@xxxxxxxxxx To: pysqlite mailing list <pysqlite-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx> a> cc: Sent by: Subject: Re: [pysqlite] .dump command of sqlite pysqlite-bounces@list s.initd.org 05/01/2006 12:28 AM Hi. I am looking to test whether a table is in an sqlite database. What is the name of the table. In postgres this would be a lookup in pg_tables. Many thanks. Regards, David _______________________________________________ pysqlite mailing list pysqlite-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx http://lists.initd.org/mailman/listinfo/pysqlite ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please call the help desk at ext 4850 ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Emulating a sequence: 00022, ggivler-zdgUFu1MqnQ |
|---|---|
| Next by Date: | Re: Emulating a sequence: 00022, David Pratt |
| Previous by Thread: | Re: .dump command of sqlitei: 00022, David Pratt |
| Next by Thread: | Database is locked error on 2nd conn: 00022, David Pratt |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |