:param old_table_name: old name.
:param new_table_name: new name.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
+
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
self.impl.rename_table(
:param existing_autoincrement: Optional; the existing autoincrement
of the column. Used for MySQL's system of altering a column
that specifies ``AUTO_INCREMENT``.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
- .. versionadded:: 0.4.0
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
:param table_name: String name of the parent table.
:param column: a :class:`sqlalchemy.schema.Column` object
representing the new column.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
+
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
- .. versionadded:: 0.4.0
"""
:param table_name: name of table
:param column_name: name of column
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
- .. versionadded:: 0.4.0
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
:param mssql_drop_check: Optional boolean. When ``True``, on
Microsoft SQL Server only, first
:param table_name: String name of the target table.
:param cols: a list of string column names to be applied to the
primary key constraint.
- :param schema: Optional schema name of the table.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
+
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
self.impl.add_constraint(
NOT DEFERRABLE when issuing DDL for this constraint.
:param initially: optional string. If set, emit INITIALLY <value>
when issuing DDL for this constraint.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
- .. versionadded:: 0.4.0
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
NOT DEFERRABLE when issuing DDL for this constraint.
:param initially: optional string. If set, emit INITIALLY <value>
when issuing DDL for this constraint.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
+
+ .. versionadded:: 0.4.0 support for 'schema'
- ..versionadded:: 0.4.0
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
self.impl.add_constraint(
the table, as well as optional :class:`~sqlalchemy.schema.Constraint`
objects
and :class:`~.sqlalchemy.schema.Index` objects.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
+
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
:param \**kw: Other keyword arguments are passed to the underlying
:class:`sqlalchemy.schema.Table` object created for the command.
drop_table("accounts")
:param name: Name of the table
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
+
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
.. versionadded:: 0.4.0
:param columns: a list consisting of string column names and/or
:func:`~sqlalchemy.sql.expression.text` constructs.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
- .. versionadded:: 0.4.0
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
The old name will continue to function for backwards
compatibility.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
- .. versionadded:: 0.4.0
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
# need a dummy column name here since SQLAlchemy
.. versionadded:: 0.3.6 'primary' qualfier to enable
dropping of MySQL primary key constraints.
- :param schema: Optional schema name to operate within.
+ :param schema: Optional schema name to operate within. To control
+ quoting of the schema outside of the default behavior, use
+ the SQLAlchemy construct
+ :class:`~sqlalchemy.sql.elements.quoted_name`.
- .. versionadded:: 0.4.0
+ .. versionadded:: 0.4.0 support for 'schema'
+
+ .. versionadded:: 0.7.0 'schema' can now accept a
+ :class:`~sqlalchemy.sql.elements.quoted_name` construct.
"""
op.create_index, 'name', 'tname', [func.foo(column('x'))]
)
+ @config.requirements.sqlalchemy_09
+ def test_add_column_schema_hard_quoting(self):
+ from sqlalchemy.sql.schema import quoted_name
+ context = op_fixture("postgresql")
+ op.add_column(
+ "somename", Column("colname", String),
+ schema=quoted_name("some.schema", quote=True))
+
+ context.assert_(
+ 'ALTER TABLE "some.schema".somename ADD COLUMN colname VARCHAR'
+ )
+
+ @config.requirements.sqlalchemy_09
+ def test_rename_table_schema_hard_quoting(self):
+ from sqlalchemy.sql.schema import quoted_name
+ context = op_fixture("postgresql")
+ op.rename_table(
+ 't1', 't2',
+ schema=quoted_name("some.schema", quote=True))
+
+ context.assert_(
+ 'ALTER TABLE "some.schema".t1 RENAME TO t2'
+ )
+
+ @config.requirements.sqlalchemy_09
+ def test_add_constraint_schema_hard_quoting(self):
+ from sqlalchemy.sql.schema import quoted_name
+ context = op_fixture("postgresql")
+ op.create_check_constraint(
+ "ck_user_name_len",
+ "user_table",
+ func.len(column('name')) > 5,
+ schema=quoted_name("some.schema", quote=True)
+ )
+ context.assert_(
+ 'ALTER TABLE "some.schema".user_table ADD '
+ 'CONSTRAINT ck_user_name_len CHECK (len(name) > 5)'
+ )
+
def test_create_index_quoting(self):
context = op_fixture("postgresql")
op.create_index(