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

Python schema.create_tables函数代码示例

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

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



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

示例1: upgrade

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

    # new table with desired columns, indexes, and constraints
    new_agent_heartbeats = Table(
        'agent_heartbeats', meta,
        Column('id', String(36), primary_key=True, nullable=False),
        Column('instance_id', String(36),
               nullable=False, unique=True, index=True),
        Column('guest_agent_version', String(255), index=True),
        Column('deleted', Boolean(), index=True),
        Column('deleted_at', DateTime()),
        Column('updated_at', DateTime(), nullable=False))

    # original table from migration 005_heartbeat.py
    previous_agent_heartbeats = Table('agent_heartbeats', meta, autoload=True)

    try:
        drop_tables([previous_agent_heartbeats])
    except OperationalError as e:
        logger.warn("This table may have been dropped by some other means.")
        logger.warn(e)

    create_tables([new_agent_heartbeats])
开发者ID:Tesora,项目名称:tesora-trove,代码行数:25,代码来源:028_recreate_agent_heartbeat.py


示例2: 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


示例3: 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


示例4: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    Table(
        'instances',
        meta,
        autoload=True,
    )
    create_tables([security_groups, security_group_rules,
                   security_group_instance_associations])
开发者ID:Tesora,项目名称:tesora-trove,代码行数:9,代码来源:013_add_security_group_artifacts.py


示例5: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    Table('datastores', meta, autoload=True)
    Table('datastore_versions', meta, autoload=True)
    instances = Table('instances', meta, autoload=True)
    create_tables([clusters])
    instances.create_column(Column('cluster_id', String(36),
                                   ForeignKey("clusters.id")))
    instances.create_column(Column('shard_id', String(36)))
    instances.create_column(Column('type', String(64)))
    cluster_id_idx = Index("instances_cluster_id", instances.c.cluster_id)
    cluster_id_idx.create()
开发者ID:Hopebaytech,项目名称:trove,代码行数:12,代码来源:032_clusters.py


示例6: 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


示例7: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine

    # for some reason we have to load the table before we can FK to it
    Table('instances', meta, autoload=True)
    create_tables([scheduled_task_types, scheduled_tasks])

    scheduled_task_types.insert().values(
        type='backup',
        enabled=True,
        description="Back up the data store for a specific instance:\n"
        "This will perform a full backup at the scheduled interval "
        "and incremental backups at a reasonable frequency in between",
    ).execute()
开发者ID:wrongfan,项目名称:trove,代码行数:14,代码来源:026_add_scheduled_tasks.py


示例8: 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


示例9: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    instance_group = Table('instance_group', meta, autoload=True)
    backups = Table('backups', meta, autoload=True)
    backups.create_column(Column('group_id', String(36)))
    backups.create_column(Column('type', String(36)))
    backups.create_column(Column('expire_at',Integer()))
    backups.create_column(Column('service_image_id',String(36)))
    
    instances = Table('instances', meta, autoload=True)
    instances.create_column(Column('group_id',String(36)))

#    drop_tables([security_group_instance_associations])    

    create_tables([InstanceGroup,InstanceGroupItem,InstanceVip,Vips,Autobackup,
                   security_group_group_associations])
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:16,代码来源:016_add_by_ksc.py


示例10: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    Table('datastores', meta, autoload=True)
    Table('datastore_versions', meta, autoload=True)
    instances = Table('instances', meta, autoload=True)

    # 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([clusters])

        instances.create_column(Column('cluster_id', String(36),
                                       ForeignKey("clusters.id")))
        instances.create_column(Column('shard_id', String(36)))
        instances.create_column(Column('type', String(64)))

        cluster_id_idx = Index("instances_cluster_id", instances.c.cluster_id)
        cluster_id_idx.create()
    except OperationalError as e:
        logger.info(e)
开发者ID:rumale,项目名称:trove,代码行数:21,代码来源:032_clusters.py


示例11: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([conductor_lastseen])
开发者ID:neetugrewal,项目名称:trove,代码行数:3,代码来源:021_conductor_last_seen.py


示例12: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([agent_heartbeats])
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:3,代码来源:005_heartbeat.py


示例13: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([root_enabled_history])
开发者ID:abansal,项目名称:trove,代码行数:3,代码来源:004_root_enabled.py


示例14: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([private_net])
开发者ID:zhujzhuo,项目名称:trove-1.0.10.4,代码行数:3,代码来源:028_ksc_private_net.py


示例15: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([quotas, quota_usages, reservations])
开发者ID:Tesora,项目名称:tesora-trove,代码行数:3,代码来源:011_quota.py


示例16: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    # Load the datastore_versions table into the session.
    # creates datastore_version_metadata table
    Table('datastore_versions', meta, autoload=True)
    create_tables([datastore_version_metadata])
开发者ID:Hopebaytech,项目名称:trove,代码行数:6,代码来源:036_add_datastore_version_metadata.py


示例17: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    Table('datastore_versions', meta, autoload=True)
    create_tables([datastore_configuration_parameters])
开发者ID:AlexeyDeyneko,项目名称:trove,代码行数:4,代码来源:033_datastore_parameters.py


示例18: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([instances])
开发者ID:abansal,项目名称:trove,代码行数:3,代码来源:001_base_schema.py


示例19: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    create_tables([usage_events])
开发者ID:CiscoSystems,项目名称:openstack-trove,代码行数:3,代码来源:010_add_usage.py


示例20: upgrade

def upgrade(migrate_engine):
    meta.bind = migrate_engine
    Table('instances', meta, autoload=True)
    create_tables([modules, instance_modules])
开发者ID:bhaskarduvvuri,项目名称:trove,代码行数:4,代码来源:037_modules.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python schema.Table类代码示例发布时间:2022-05-27
下一篇:
Python db.get_db_api函数代码示例发布时间: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