Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > MySQL from python - dropping a database IF EXISTS

Reply
Thread Tools

MySQL from python - dropping a database IF EXISTS

 
 
Ben
Guest
Posts: n/a
 
      12-04-2006
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

 
Reply With Quote
 
 
 
 
Ben
Guest
Posts: n/a
 
      12-04-2006
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


 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-05-2006
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/...-warnings.html

</F>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
How to check if a directory exists? folder.exists() does not work! Ulf Meinhardt Java 8 08-28-2009 12:26 PM
finding if file exists or not in apache webdav server and if exists what is the mime type of it.... Totan Java 0 04-17-2006 05:13 AM
ADSL Dropping But not Dropping!! Chris Bales Computer Support 9 08-29-2004 06:25 PM



Advertisments