has_batch = autogen_context._has_batch
if constraint.deferrable:
- opts.append(("deferrable", str(constraint.deferrable)))
+ opts.append(("deferrable", constraint.deferrable))
if constraint.initially:
- opts.append(("initially", str(constraint.initially)))
+ opts.append(("initially", constraint.initially))
if not has_batch and alter and constraint.table.schema:
opts.append(("schema", _ident(constraint.table.schema)))
if not alter and constraint.name:
--- /dev/null
+.. change::
+ :tags: bug, autogenerate
+ :tickets: 1613
+
+ Fixed autogenerate rendering bug where the ``deferrable`` element of
+ ``UniqueConstraint``, a bool, were being stringified rather than repr'ed
+ when generating Python code.
t = Table("t", self.metadata, Column("c", Integer))
eq_ignore_whitespace(
autogenerate.render._render_unique_constraint(
- UniqueConstraint(t.c.c, deferrable="XYZ"),
+ UniqueConstraint(t.c.c, deferrable=True),
self.autogen_context,
None,
),
- "sa.UniqueConstraint('c', deferrable='XYZ', "
+ "sa.UniqueConstraint('c', deferrable=True, "
"name=op.f('uq_ct_t_c'))",
)