Peter wrote: > Hi > I do: > > engine = create_engine('mysql://r...@localhost/tmp) > Session = sessionmaker() > Session.configure(bind=engine) > connection = engine.connect() > session = Session() > > # suppose database TEST exists > connection.execute('CREATE DATABASE IF NOT EXISTS TEST') > > Why does this gives a warning : > > /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.6-py2.5.egg/sqlalchemy/engine/default.py:123: > > Warning: Can't create database 'TEST'; database exists > cursor.execute(statement, parameters) >
It looks like the MySQLdb cursor is emitting the warning, and AFAIK there is no way to prevent MySQLdb from generating warnings. You can tell Python to suppress this specific warning via: import MySQLdb import warnings warnings.filterwarnings( action="ignore", category=MySQLdb.Warning, message="Can't create database 'TEST'; database exists") or suppress all MySQLdb warnings via: import MySQLdb import warnings warnings.filterwarnings( action="ignore", category=MySQLdb.Warning) -Conor -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=.