Re: MySQL from python - dropping a database IF EXISTS

2006-12-04 Thread Ben
Ah well - I turned off warnings as a solution. Its a bit f a bodge, but
it works :-)


Ben wrote:

 Can someone explain why this might be happening:

 parser_beta.py:129: Warning: Can't drop database 'foobar'; database
 doesn't exist
   self.cursor.execute(DROP DATABASE IF EXISTS +name)

 But the whole point about the IF EXISTS bit is (I thought) that it
 will only drop it if it exists, if it doesn't do nothing and don't
 throw an error.

 I'm using MySQL 5.024 and python 2.4.3

 It still works, but the unneccesary error is annoying :-) Any ideas?
 
 Cheers,
 
 Ben

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQL from python - dropping a database IF EXISTS

2006-12-04 Thread Fredrik Lundh
Ben wrote:

 Ah well - I turned off warnings as a solution. Its a bit f a bodge, but
 it works :-)

according to the documentation, the database does generate a note when 
you do this:

 http://dev.mysql.com/doc/refman/5.0/en/drop-table.html

and notes can be turned off independently of warnings, it seems:

 http://dev.mysql.com/doc/refman/5.0/en/show-warnings.html

/F

-- 
http://mail.python.org/mailman/listinfo/python-list