:tags: bug, sql
:tickets: 7664
- Fixed stringify for a the :class:`.CreateSchema` DDL construct, which would
- fail with an ``AttributeError`` when stringified without a dialect.
+ Fixed stringify for a the :class:`.CreateSchema` and :class:`.DropSchema`
+ DDL constructs, which would fail with an ``AttributeError`` when
+ stringified without a dialect.
__visit_name__ = "drop_schema"
+ stringify_dialect = "default"
+
def __init__(self, name, quote=None, cascade=False, **kw):
"""Create a new :class:`.DropSchema` construct."""
@testing.combinations(
(schema.CreateSchema("sa_schema"), "CREATE SCHEMA sa_schema"),
+ (schema.DropSchema("sa_schema"), "DROP SCHEMA sa_schema"),
# note we don't yet support lower-case table() or
# lower-case column() for this
# (
schema.CreateTable(Table("t", MetaData(), Column("q", Integer))),
"CREATE TABLE t (q INTEGER)",
),
+ (
+ schema.DropTable(Table("t", MetaData(), Column("q", Integer))),
+ "DROP TABLE t",
+ ),
(
schema.CreateIndex(
Index(
),
"CREATE INDEX foo ON t (x)",
),
+ (
+ schema.DropIndex(
+ Index(
+ "foo",
+ "x",
+ _table=Table("t", MetaData(), Column("x", Integer)),
+ )
+ ),
+ "DROP INDEX foo",
+ ),
+ (
+ schema.CreateSequence(Sequence("my_seq")),
+ "CREATE SEQUENCE my_seq START WITH 1",
+ ),
+ (schema.DropSequence(Sequence("my_seq")), "DROP SEQUENCE my_seq"),
)
def test_stringify_schema_elements(self, element, expected):
eq_ignore_whitespace(str(element), expected)