From 1e1dc116fb9af31d27e9f58a5fd77e3b24708a5a Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 7 Dec 2009 14:45:33 -0500 Subject: [PATCH] Suppress CREATE DATABASE IF NOT EXISTS warnings. Signed-off-by: Edward Z. Yang --- wizard/install/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wizard/install/__init__.py b/wizard/install/__init__.py index 2cac842..f538841 100644 --- a/wizard/install/__init__.py +++ b/wizard/install/__init__.py @@ -23,6 +23,7 @@ allow applications to refer to them as a single name. import os import logging import sqlalchemy +import warnings import wizard from wizard import scripts, shell, util @@ -34,8 +35,10 @@ def dsn_callback(options): database = options.dsn.database options.dsn.database = None engine = sqlalchemy.create_engine(options.dsn) - # generates warnings yeah yeah - engine.execute("CREATE DATABASE IF NOT EXISTS `%s`" % database) + # generates warnings http://groups.google.com/group/sqlalchemy/browse_thread/thread/b7123fefb7dd83d5 + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + engine.execute("CREATE DATABASE IF NOT EXISTS `%s`" % database) options.dsn.database = database # XXX: another good thing to check might be that the database is empty -- 2.45.1