Create a DDL statement. :param statement: A string or unicode string to be executed. Statements will be processed with Python's string formatting operator using a fixed set of string substitutions, as well as additional substitutions provided by the
(self, statement, context=None)
| 392 | __visit_name__ = "ddl" |
| 393 | |
| 394 | def __init__(self, statement, context=None): |
| 395 | """Create a DDL statement. |
| 396 | |
| 397 | :param statement: |
| 398 | A string or unicode string to be executed. Statements will be |
| 399 | processed with Python's string formatting operator using |
| 400 | a fixed set of string substitutions, as well as additional |
| 401 | substitutions provided by the optional :paramref:`.DDL.context` |
| 402 | parameter. |
| 403 | |
| 404 | A literal '%' in a statement must be escaped as '%%'. |
| 405 | |
| 406 | SQL bind parameters are not available in DDL statements. |
| 407 | |
| 408 | :param context: |
| 409 | Optional dictionary, defaults to None. These values will be |
| 410 | available for use in string substitutions on the DDL statement. |
| 411 | |
| 412 | .. seealso:: |
| 413 | |
| 414 | :class:`.DDLEvents` |
| 415 | |
| 416 | :ref:`event_toplevel` |
| 417 | |
| 418 | """ |
| 419 | |
| 420 | if not isinstance(statement, str): |
| 421 | raise exc.ArgumentError( |
| 422 | "Expected a string or unicode SQL statement, got '%r'" |
| 423 | % statement |
| 424 | ) |
| 425 | |
| 426 | self.statement = statement |
| 427 | self.context = context or {} |
| 428 | |
| 429 | def __repr__(self): |
| 430 | parts = [repr(self.statement)] |
no outgoing calls
no test coverage detected