473,472 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MySQL from python - dropping a database IF EXISTS

Ben
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

Dec 4 '06 #1
2 4168
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
Dec 4 '06 #2
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>

Dec 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Josh | last post by:
Hi, First off, I am a newbie to Python and so far I must say that we're getting along pretty well. My schooling was is C/C++, but have been writing code in, dare I say it, VB, for the past 4...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
2
by: Don | last post by:
I'm new to MySQL and am having a frustrating time figuring out some of the tools. I'm getting ERROR 1044 when I try to execute the following sp. ------------------------------ DELIMITER $$ ...
5
by: phillip.s.powell | last post by:
$sql = "SELECT IF((SHOW TABLES LIKE '$subselectTableName'), count(*), NULL) AS numRows FROM $subselectTableName"; I am trying to write a SQL statement that will tell me if a table exists or not,...
122
by: Edward Diener No Spam | last post by:
The definition of a component model I use below is a class which allows properties, methods, and events in a structured way which can be recognized, usually through some form of introspection...
14
by: Ben | last post by:
I don't know whether anyone can help, but I have an odd problem. I have a PSP (Spyce) script that makes many calls to populate a database. They all work without any problem except for one...
1
by: paulq182 | last post by:
PLEASE HELP ME WITH MY CODE?? import java.sql.*; import java.io.*; class min_filmdb_rel_mysql { public static void main (String args ) throws SQLException, IOException {
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.