本文整理匯總了Python中trove.db.sqlalchemy.migrate_repo.schema.Table.update方法的典型用法代碼示例。如果您正苦於以下問題:Python Table.update方法的具體用法?Python Table.update怎麽用?Python Table.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類trove.db.sqlalchemy.migrate_repo.schema.Table
的用法示例。
在下文中一共展示了Table.update方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: upgrade
# 需要導入模塊: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 別名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import update [as 別名]
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
service_type = Column('service_type', String(36))
instances.create_column(service_type)
instances.update().values({'service_type': 'mysql'}).execute()
示例2: downgrade
# 需要導入模塊: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 別名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import update [as 別名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
drop_tables([datastores, datastore_versions])
instances = Table('instances', meta, autoload=True)
instances.drop_column('datastore_version_id')
service_type = Column('service_type', String(36))
instances.create_column(service_type)
instances.update().values({'service_type': 'mysql'}).execute()
示例3: downgrade
# 需要導入模塊: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 別名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import update [as 別名]
def downgrade(migrate_engine):
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
constraint_names = db_utils.get_foreign_key_constraint_names(
engine=migrate_engine,
table='instances',
columns=['datastore_version_id'],
ref_table='datastore_versions',
ref_columns=['id'])
db_utils.drop_foreign_key_constraints(
constraint_names=constraint_names,
columns=[instances.c.datastore_version_id],
ref_columns=[datastore_versions.c.id])
instances.drop_column('datastore_version_id')
service_type = Column('service_type', String(36))
instances.create_column(service_type)
instances.update().values({'service_type': 'mysql'}).execute()
drop_tables([datastore_versions, datastores])
示例4: upgrade
# 需要導入模塊: from trove.db.sqlalchemy.migrate_repo.schema import Table [as 別名]
# 或者: from trove.db.sqlalchemy.migrate_repo.schema.Table import update [as 別名]
def upgrade(migrate_engine):
meta.bind = migrate_engine
instances = Table('instances', meta, autoload=True)
instances.create_column(Column('region_id', String(255)))
instances.update().values(region_id=CONF.os_region_name).execute()