Surpressing Warnings
Victor Subervi
victorsubervi at gmail.com
Sun Aug 16 11:30:34 EDT 2009
This is strange because I actually had "if exists" in my code:
sqlKWDrop = 'DROP TABLE IF EXISTS ' + kwTable + ';'
where kwTable, in the instance cited below, becomes "judaism_128". What
gives?
Victor
On Sun, Aug 9, 2009 at 7:57 PM, Dennis Lee Bieber <wlfraed at ix.netcom.com>wrote:
> On Sun, 9 Aug 2009 15:21:43 -0500, Victor Subervi
> <victorsubervi at gmail.com> declaimed the following in
> gmane.comp.python.general:
>
> > Hi:
> > I get a ton of warnings like this from a program I run:
> >
> > Warning (from warnings module):
> > File "C:\Python25\read.py", line 67
> > cursor.execute(sqlKWDrop)
> > Warning: Unknown table 'judaism_128'
> >
> Personally -- I'd suggest fixing the database so that the table
> does
> exist...
>
> Ah, but then -- it appears from the name, that the purpose of this
> SQL statement is to delete the table... In which case use a database
> that supports (for example, current versions of MySQL, SQLite, and
> PostgreSQL) "drop table IF EXISTS tbl_name" which suppress the
> warning/error message and update the SQL as appropriate.
>
> Appears that M$ SQL Server does NOT implement that syntax... Nor
> could I find it for Firebird.
>
> If the application is specific for one database engine, it might be
> worth it to find out what features permit discovering if a table exists
> and bypassing the drop if it doesn't...
>
>
> --
> Wulfraed Dennis Lee Bieber KD6MOG
> wlfraed at ix.netcom.com HTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090816/87a9478c/attachment-0001.html>
More information about the Python-list
mailing list