backwards compatibility. A note about backslashing escapes is added.
Because the Text() construct now supports bind params better, the example
given in the code raises an exception now, so that should cover us.
The exception itself has been enhanced to include the key name of the
bound param. We're backporting this to 0.8 but 0.8 doesn't have the
text->bind behavior that raises.
Conflicts:
lib/sqlalchemy/sql/schema.py
.. changelog::
:version: 0.8.5
+ .. change::
+ :tags: enhancement, sql
+ :versions: 0.9.0b2
+
+ The exception raised when a :class:`.BindParameter` is present
+ in a compiled statement without a value now includes the key name
+ of the bound parameter in the error message.
+
.. change::
:tags: bug, orm
:versions: 0.9.0b2
:param sqltext:
A string containing the constraint definition, which will be used
- verbatim, or a SQL expression construct.
+ verbatim, or a SQL expression construct. If given as a string,
+ the object is converted to a :class:`.Text` object. If the textual
+ string includes a colon character, escape this using a backslash::
+
+ CheckConstraint(r"foo ~ E'a(?\:b|c)d")
:param name:
Optional, the in-database name of the constraint.
(within_columns_clause and \
self.ansi_bind_rules):
if bindparam.value is None:
- raise exc.CompileError("Bind parameter without a "
- "renderable value not allowed here.")
+ raise exc.CompileError("Bind parameter '%s' without a "
+ "renderable value not allowed here."
+ % bindparam.key)
return self.render_literal_bindparam(bindparam,
within_columns_clause=True, **kwargs)
dialect=dialect
)
- assert_raises(
+ assert_raises_message(
exc.CompileError,
+ "Bind parameter 'foo' without a renderable value not allowed here.",
bindparam("foo").in_([]).compile, dialect=dialect
)