add CreateDatabase() / DropDatabase() DDL object

Issue #3382 new
Unknown Name
created an issue

Only in this way to create:

from sqlalchemy import create_engine from sqlalchemy.engine.url import make_url

url = mysql://root:root@localhost:3306/wiki20?charset=utf8 engine = create_engine(url, echo=True) database=make_url(url).translate_connect_args().get('database') if database: engine.connect().execute("create database if not exists %s"%database)

Comments (1)

  1. Michael Bayer repo owner

    at most, this feature would only handle the fact that a database is named "somedatabase" and it would emit "CREATE DATABASE" / "DROP DATABASE". It isn't going to be inferred from the URL as in this example, as the URL is not a schema construct; it's more likely that one would want to create a database of a name that is not in the URL (at least that's how I usually have to).

    in that regard, create/drop database is so simplistic in its plain form, yet so vendor-specific in most of its other forms, that there's little reason for this construct.

  2. Log in to comment