:version: 2.0.0
:released: January 26, 2023
+ .. change::
+ :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. Update: Note this fix failed to accommodate for
+ :class:`.DropSchema`; a followup fix in version 2.0.1 repairs this
+ case. The fix for both elements is backported to 1.4.47.
+
.. change::
:tags: usecase, orm extensions
:tickets: 5145
.. change::
:tags: bug, sql
:tickets: 7664
- :versions: 2.0.0
- 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.
--- /dev/null
+.. change::
+ :tags: bug, sql
+ :tickets: 7664
+
+ Corrected the fix for :ticket:`7664`, released in version 2.0.0, to also
+ include :class:`.DropSchema` which was inadvertently missed in this fix,
+ allowing stringification without a dialect. The fixes for both constructs
+ is backported to the 1.4 series as of 1.4.47.
+
@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"),
+ (schema.DropSequence(Sequence("my_seq")), "DROP SEQUENCE my_seq"),
)
def test_stringify_schema_elements(self, element, expected):
eq_ignore_whitespace(str(element), expected)