The nova.db.sqlalchemy.utils Module

class InsertFromSelect(table, select)

Bases: sqlalchemy.sql.expression.UpdateBase

drop_old_duplicate_entries_from_table(migrate_engine, table_name, use_soft_delete, *uc_column_names)

This method is used to drop all old rows that have the same values for columns in uc_columns.

drop_unique_constraint(migrate_engine, table_name, uc_name, *columns, **col_name_col_instance)

This method drops UC from table and works for mysql, postgresql and sqlite. In mysql and postgresql we are able to use “alter table” constuction. In sqlite is only one way to drop UC:

  1. Create new table with same columns, indexes and constraints (except one that we want to drop).
  2. Copy data from old table to new.
  3. Drop old table.
  4. Rename new table to the name of old table.
Parameters:
  • migrate_engine – sqlalchemy engine
  • table_name – name of table that contains uniq constarint.
  • uc_name – name of uniq constraint that will be dropped.
  • columns – columns that are in uniq constarint.
  • col_name_col_instance – contains pair column_name=column_instance. column_instance is instance of Column. These params are required only for columns that have unsupported types by sqlite. For example BigInteger.
visit_insert_from_select(element, compiler, **kw)

Previous topic

The nova.db.sqlalchemy.types Module

Next topic

The nova.exception Module

This Page