當前位置: 首頁>>代碼示例>>Python>>正文


Python schema.Table類代碼示例

本文整理匯總了Python中trove.db.sqlalchemy.migrate_repo.schema.Table的典型用法代碼示例。如果您正苦於以下問題:Python Table類的具體用法?Python Table怎麽用?Python Table使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Table類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的trove.db.sqlalchemy.migrate_repo.schema.Table類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。