• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python schema.Table类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中trove.db.sqlalchemy.migrate_repo.schema.Table的典型用法代码示例。如果您正苦于以下问题:Python Table类的具体用法?Python Table怎么用?Python Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Table类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: upgrade

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    instances = Table('instances', meta, autoload=True)
    instances.create_column(
        Column(COLUMN_NAME, String(36), ForeignKey('instances.id')),
        nullable=True)
开发者ID:Hopebaytech,项目名称:trove,代码行数:7,代码来源:030_add_master_slave.py


示例2: downgrade

def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    modules = Table('modules', meta, autoload=True)
    modules.drop_column(COLUMN_NAME_1)
    modules.drop_column(COLUMN_NAME_2)
    modules.drop_column(COLUMN_NAME_3)
开发者ID:Tesora-Release,项目名称:tesora-trove,代码行数:7,代码来源:040_module_priority.py


示例3: upgrade

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    backups = Table('backups', meta, autoload=True)
    backups.create_column(Column('parent_id', String(36), nullable=True))
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:7,代码来源:022_add_backup_parent_id.py


示例4: upgrade

def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)
    configurations = Table('configurations', meta, autoload=True)
    created = Column('created', DateTime())
    updated = Column('updated', DateTime())
    configurations.create_column(created)
    configurations.create_column(updated)
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:7,代码来源:031_add_timestamps_to_configurations.py


示例5: downgrade

def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # drop column:
    backups = Table('backups', meta, autoload=True)
    backups.drop_column('parent_id')
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:7,代码来源:022_add_backup_parent_id.py


示例6: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([configurations])
    create_tables([configuration_parameters])
    instances = Table('instances', meta, autoload=True)
    instances.create_column(Column('configuration_id', String(36),
                                   ForeignKey("configurations.id")))
开发者ID:cretta,项目名称:trove,代码行数:7,代码来源:020_configurations.py


示例7: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    # Load 'configurations' table to MetaData.
    Table('configurations', meta, autoload=True, autoload_with=migrate_engine)
    instances = Table('clusters', meta, autoload=True)
    instances.create_column(Column('configuration_id', String(36),
                                   ForeignKey("configurations.id")))
开发者ID:Tesora,项目名称:tesora-trove,代码行数:7,代码来源:041_add_cluster_configuration_id.py


示例8: upgrade

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()
开发者ID:Tesora,项目名称:tesora-trove,代码行数:7,代码来源:015_add_service_type.py


示例9: upgrade

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    instances = Table('instances', meta, autoload=True)
    instances.create_column(Column('tenant_id', String(36), nullable=True))
    instances.create_column(Column('server_status', String(64)))
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:8,代码来源:008_add_instance_fields.py


示例10: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([datastores, datastore_versions])
    instances = Table('instances', meta, autoload=True)
    datastore_version_id = Column('datastore_version_id', String(36),
                                  ForeignKey('datastore_versions.id'))
    instances.create_column(datastore_version_id)
    instances.drop_column('service_type')
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:8,代码来源:016_add_datastore_type.py


示例11: downgrade

def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # drop column:
    instances = Table('instances', meta, autoload=True)
    instances.drop_column('deleted')
    instances.drop_column('deleted_at')
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:8,代码来源:009_add_deleted_flag_to_instances.py


示例12: upgrade

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    instances = Table('instances', meta, autoload=True)
    instances.create_column(Column('deleted', Boolean()))
    instances.create_column(Column('deleted_at', DateTime()))
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:8,代码来源:009_add_deleted_flag_to_instances.py


示例13: upgrade

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine
    backups = Table('backups', meta, autoload=True)
    Table('datastore_versions', meta, autoload=True)
    datastore_version_id = Column('datastore_version_id', String(36),
                                  ForeignKey('datastore_versions.id'))
    backups.create_column(datastore_version_id)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:8,代码来源:029_add_backup_datastore.py


示例14: downgrade

def downgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # drop column:
    backups = Table('backups', meta, autoload=True)
    migrate_engine.execute('DROP INDEX backups_parent_id_idx ON backups')
    migrate_engine.execute('DROP INDEX backups_deleted_idx ON backups')
    backups.drop_column('parent_id')
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:9,代码来源:027_add_by_ksc_add_backups_parent_id.py


示例15: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    instance_vip = Table('instance_vip', meta, autoload=True)
    instance_vip.create_column(Column('virtual_instance_id', String(36)))
    
    def update_instance_vips():
        update(table = instance_vip, whereclause="deleted = 0", 
               values=dict(virtual_instance_id = instance_vip.c.instance_id)).execute()
    
    update_instance_vips()
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:10,代码来源:026_ksc_add_virtual_instance_id.py


示例16: downgrade

def downgrade(migrate_engine):
    meta = MetaData()
    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=[COLUMN_NAME], ref_table="instances", ref_columns=["id"]
    )
    db_utils.drop_foreign_key_constraints(
        constraint_names=constraint_names, columns=[instances.c.slave_of_id], ref_columns=[instances.c.id]
    )
    instances.drop_column(COLUMN_NAME)
开发者ID:pombredanne,项目名称:RDS,代码行数:11,代码来源:030_add_master_slave.py


示例17: upgrade

def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    # add column:
    instances = Table('instances', meta, autoload=True)
    volume_size = Column('volume_size', Integer())
    flavor_id = Column('flavor_id', String(36))

    instances.create_column(flavor_id)
    instances.create_column(volume_size)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:11,代码来源:007_add_volume_flavor.py


示例18: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([datastores, datastore_versions])
    
#     ----------------------------------------------------
#     Fore. 2014/06/19 Not modify old schemas on Instance.
#     ----------------------------------------------------
    instances = Table('instances', meta, autoload=True)
#     datastore_version_id = Column('datastore_version_id', String(36),
#                                   ForeignKey('datastore_versions.id'))
    datastore_version_id = Column('datastore_version_id', String(36), nullable = True)
    instances.create_column(datastore_version_id)
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:12,代码来源:018_add_datastore_type.py


示例19: downgrade

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=['configuration_id'],
        ref_table='configurations',
        ref_columns=['id'])
    db_utils.drop_foreign_key_constraints(
        constraint_names=constraint_names,
        columns=[instances.c.configuration_id],
        ref_columns=[configurations.c.id])
    instances.drop_column('configuration_id')
    drop_tables([configuration_parameters, configurations])
开发者ID:cretta,项目名称:trove,代码行数:15,代码来源:020_configurations.py


示例20: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine

    # since the downgrade is a no-op, an upgrade after a downgrade will
    # cause an exception because the tables already exist
    # we will catch that case and log an info message
    try:
        create_tables([configurations])
        create_tables([configuration_parameters])

        instances = Table('instances', meta, autoload=True)
        instances.create_column(Column('configuration_id', String(36),
                                       ForeignKey("configurations.id")))
    except OperationalError as e:
        logger.info(e)
开发者ID:B-Rich,项目名称:trove,代码行数:15,代码来源:020_configurations.py



注:本文中的trove.db.sqlalchemy.migrate_repo.schema.Table类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.load_and_verify函数代码示例发布时间:2022-05-27
下一篇:
Python common.fetch_json函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap