当前位置: 首页>>代码示例>>Python>>正文


Python postgresql.UUID属性代码示例

本文整理汇总了Python中sqlalchemy.dialects.postgresql.UUID属性的典型用法代码示例。如果您正苦于以下问题:Python postgresql.UUID属性的具体用法?Python postgresql.UUID怎么用?Python postgresql.UUID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sqlalchemy.dialects.postgresql的用法示例。


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

示例1: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    op.drop_constraint('fk_vfolder_attachment_vfolder_vfolders', 'vfolder_attachment', type_='foreignkey')
    op.drop_constraint('fk_vfolder_attachment_kernel_kernels', 'vfolder_attachment', type_='foreignkey')
    op.drop_constraint('pk_kernels', 'kernels', type_='primary')
    op.add_column('kernels',
                  sa.Column('id', GUID(),
                            server_default=sa.text('uuid_generate_v4()'),
                            nullable=False))
    op.add_column('kernels', sa.Column('role', sa.String(length=16), nullable=False, default='master'))
    op.create_primary_key('pk_kernels', 'kernels', ['id'])
    op.alter_column(
        'kernels', 'sess_id',
        existing_type=postgresql.UUID(),
        type_=sa.String(length=64),
        nullable=True,
        existing_server_default=sa.text('uuid_generate_v4()'))
    op.create_index(op.f('ix_kernels_sess_id'), 'kernels', ['sess_id'], unique=False)
    op.create_index(op.f('ix_kernels_sess_id_role'), 'kernels', ['sess_id', 'role'], unique=False)
    op.create_foreign_key('fk_vfolder_attachment_vfolder_vfolders',
                          'vfolder_attachment', 'vfolders',
                          ['vfolder'], ['id'], onupdate='CASCADE', ondelete='CASCADE')
    op.create_foreign_key('fk_vfolder_attachment_kernel_kernels',
                          'vfolder_attachment', 'kernels',
                          ['kernel'], ['id'], onupdate='CASCADE', ondelete='CASCADE') 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:26,代码来源:854bd902b1bc_change_kernel_identification.py

示例2: downgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def downgrade():
    op.add_column(
        "projects",
        sa.Column("client_id", postgresql.UUID(), autoincrement=False, nullable=True),
    )
    op.add_column(
        "projects",
        sa.Column("secret_key", postgresql.UUID(), autoincrement=False, nullable=True),
    )
    op.drop_index(
        "release_username_password_is_active_idx", table_name="project_credentials"
    )
    op.drop_index(
        op.f("ix_project_credentials_is_active"), table_name="project_credentials"
    )
    op.drop_table("project_credentials") 
开发者ID:jazzband-roadies,项目名称:website,代码行数:18,代码来源:56c000fd001d_.py

示例3: downgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('output_file', sa.Column('uploaded_movie_url', sa.VARCHAR(length=600), autoincrement=False, nullable=True))
    op.add_column('output_file', sa.Column('uploaded_movie_name', sa.VARCHAR(length=150), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'output_file', type_='foreignkey')
    op.drop_constraint('output_file_uc', 'output_file', type_='unique')
    op.create_unique_constraint('output_file_uc', 'output_file', ['name', 'entity_id', 'output_type_id', 'task_type_id', 'representation', 'revision'])
    op.drop_column('output_file', 'temporal_entity_id')
    op.drop_constraint(None, 'asset_instance', type_='foreignkey')
    op.create_index('ix_asset_instance_entity_type_id', 'asset_instance', ['entity_type_id'], unique=False)
    op.create_index('ix_asset_instance_entity_id', 'asset_instance', ['entity_id'], unique=False)
    op.drop_constraint('asset_instance_uc', 'asset_instance', type_='unique')
    op.create_unique_constraint('asset_instance_uc', 'asset_instance', ['asset_id', 'entity_id', 'number'])
    op.drop_constraint('asset_instance_name_uc', 'asset_instance', type_='unique')
    op.create_unique_constraint('asset_instance_name_uc', 'asset_instance', ['entity_id', 'name'])
    op.drop_index(op.f('ix_asset_instance_scene_id'), table_name='asset_instance')
    op.alter_column('asset_instance', 'entity_type_id',
               existing_type=postgresql.UUID(),
               nullable=False)
    op.alter_column('asset_instance', 'entity_id',
               existing_type=postgresql.UUID(),
               nullable=False)
    op.drop_column('asset_instance', 'scene_id')
    op.drop_table('asset_instance_link')
    # ### end Alembic commands ### 
开发者ID:cgwire,项目名称:zou,代码行数:27,代码来源:ee2373fbe3a4_.py

示例4: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():

    op.create_table('monthly_billing',
                    sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
                    sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False),
                    sa.Column('month', sa.String(), nullable=False),
                    sa.Column('year', sa.Float(), nullable=False),
                    sa.Column('notification_type',
                              postgresql.ENUM('email', 'sms', 'letter', name='notification_type', create_type=False),
                              nullable=False),
                    sa.Column('monthly_totals', postgresql.JSON(), nullable=False),
                    sa.Column('updated_at', sa.DateTime, nullable=False),
                    sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.create_index(op.f('ix_monthly_billing_service_id'), 'monthly_billing', ['service_id'], unique=False)
    op.create_index(op.f('uix_monthly_billing'), 'monthly_billing', ['service_id', 'month', 'year', 'notification_type'], unique=True) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:19,代码来源:0110_monthly_billing.py

示例5: downgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('services_history', sa.Column('organisation_id', postgresql.UUID(), autoincrement=False, nullable=True))  # noqa
    op.add_column('services', sa.Column('organisation_id', postgresql.UUID(), autoincrement=False, nullable=True))

    op.create_table(
        'organisation',
        sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
        sa.Column('colour', sa.VARCHAR(length=7), autoincrement=False, nullable=True),
        sa.Column('logo', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
        sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
        sa.PrimaryKeyConstraint('id', name='organisation_pkey')
    )

    op.create_index('ix_services_history_organisation_id', 'services_history', ['organisation_id'], unique=False)
    op.create_foreign_key('services_organisation_id_fkey', 'services', 'organisation', ['organisation_id'], ['id'])
    op.create_index('ix_services_organisation_id', 'services', ['organisation_id'], unique=False)

    op.alter_column('service_email_branding', 'email_branding_id', nullable=True) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:21,代码来源:0162_remove_org.py

示例6: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    op.create_table(
        'domain',
        sa.Column('domain', sa.String(length=255), nullable=False),
        sa.Column('organisation_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.ForeignKeyConstraint(['organisation_id'], ['organisation.id'], ),
        sa.PrimaryKeyConstraint('domain')
    )
    op.create_index(op.f('ix_domain_domain'), 'domain', ['domain'], unique=True)

    op.add_column('organisation', sa.Column('email_branding_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_foreign_key('fk_organisation_email_branding_id', 'organisation', 'email_branding', ['email_branding_id'], ['id'])

    op.add_column('organisation', sa.Column('letter_branding_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_foreign_key('fk_organisation_letter_branding_id', 'organisation', 'letter_branding', ['letter_branding_id'], ['id'])

    op.add_column('organisation', sa.Column('agreement_signed', sa.Boolean(), nullable=True))
    op.add_column('organisation', sa.Column('agreement_signed_at', sa.DateTime(), nullable=True))
    op.add_column('organisation', sa.Column('agreement_signed_by_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.add_column('organisation', sa.Column('agreement_signed_version', sa.Float(), nullable=True))
    op.add_column('organisation', sa.Column('crown', sa.Boolean(), nullable=True))
    op.add_column('organisation', sa.Column('organisation_type', sa.String(length=255), nullable=True))
    op.create_foreign_key('fk_organisation_agreement_user_id', 'organisation', 'users', ['agreement_signed_by_id'], ['id']) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:25,代码来源:0278_add_more_stuff_to_orgs.py

示例7: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    op.create_table('job_statistics',
    sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('job_id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('emails_sent', sa.BigInteger(), nullable=False),
    sa.Column('emails_delivered', sa.BigInteger(), nullable=False),
    sa.Column('emails_failed', sa.BigInteger(), nullable=False),
    sa.Column('sms_sent', sa.BigInteger(), nullable=False),
    sa.Column('sms_delivered', sa.BigInteger(), nullable=False),
    sa.Column('sms_failed', sa.BigInteger(), nullable=False),
    sa.Column('letters_sent', sa.BigInteger(), nullable=False),
    sa.Column('letters_failed', sa.BigInteger(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_job_statistics_job_id'), 'job_statistics', ['job_id'], unique=True) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:20,代码来源:0084_add_job_stats.py

示例8: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('provider_details', sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_index(op.f('ix_provider_details_created_by_id'), 'provider_details', ['created_by_id'], unique=False)
    op.create_foreign_key('provider_details_created_by_id_fkey', 'provider_details', 'users', ['created_by_id'], ['id'])
    op.add_column('provider_details_history', sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_index(
        op.f('ix_provider_details_history_created_by_id'),
        'provider_details_history',
        ['created_by_id'],
        unique=False
    )
    op.create_foreign_key(
        'provider_details_history_created_by_id_fkey',
        'provider_details_history',
        'users',
        ['created_by_id'],
        ['id']
    )
    # ### end Alembic commands ### 
开发者ID:alphagov,项目名称:notifications-api,代码行数:22,代码来源:0068_add_created_by_to_provider.py

示例9: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    notification_types = postgresql.ENUM('email', 'sms', 'letter', name='notification_type', create_type=False)
    op.create_table('rates',
    sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('valid_from', sa.DateTime(), nullable=False),
    sa.Column('rate', sa.Numeric(), nullable=False),
    sa.Column('notification_type', notification_types, nullable=False),
    sa.PrimaryKeyConstraint('id')
    )

    op.create_index(op.f('ix_rates_notification_type'), 'rates', ['notification_type'], unique=False)

    op.get_bind()
    op.execute("INSERT INTO rates(id, valid_from, rate, notification_type) "
               "VALUES('{}', '2016-05-18 00:00:00', 1.65, 'sms')".format(uuid.uuid4()))
    op.execute("INSERT INTO rates(id, valid_from, rate, notification_type) "
               "VALUES('{}', '2017-04-01 00:00:00', 1.58, 'sms')".format(uuid.uuid4())) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:19,代码来源:0075_create_rates_table.py

示例10: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    op.create_table(
        'service_contact_list',
        sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('original_file_name', sa.String(), nullable=False),
        sa.Column('row_count', sa.Integer(), nullable=False),
        sa.Column('template_type', postgresql.ENUM(name='template_type', create_type=False), nullable=False),
        sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False),
        sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=True),
        sa.Column('created_at', sa.DateTime(), nullable=False),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(['created_by_id'], ['users.id'], ),
        sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_service_contact_list_created_by_id'), 'service_contact_list', ['created_by_id'], unique=False)
    op.create_index(op.f('ix_service_contact_list_service_id'), 'service_contact_list', ['service_id'], unique=False)
    op.add_column('jobs', sa.Column('contact_list_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_foreign_key('jobs_contact_list_id_fkey', 'jobs', 'service_contact_list', ['contact_list_id'], ['id']) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:21,代码来源:0318_service_contact_list.py

示例11: downgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('monthly_billing',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('notification_type', postgresql.ENUM('email', 'sms', 'letter', name='notification_type'), autoincrement=False, nullable=False),
    sa.Column('monthly_totals', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False),
    sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
    sa.Column('start_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
    sa.Column('end_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='monthly_billing_service_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='monthly_billing_pkey'),
    sa.UniqueConstraint('service_id', 'start_date', 'notification_type', name='uix_monthly_billing')
    )
    op.create_index('ix_monthly_billing_service_id', 'monthly_billing', ['service_id'], unique=False)
    # ### end Alembic commands ### 
开发者ID:alphagov,项目名称:notifications-api,代码行数:18,代码来源:0210_remove_monthly_billing.py

示例12: downgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def downgrade():
    op.create_table('job_statistics',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('job_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('emails_sent', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('emails_delivered', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('emails_failed', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('sms_sent', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('sms_delivered', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('sms_failed', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('letters_sent', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('letters_failed', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('sent', sa.BIGINT(), autoincrement=False, nullable=True),
    sa.Column('delivered', sa.BIGINT(), autoincrement=False, nullable=True),
    sa.Column('failed', sa.BIGINT(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], name='job_statistics_job_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='job_statistics_pkey')
    ) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:22,代码来源:0175_drop_job_statistics_table.py

示例13: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    op.create_table('service_sms_senders',
                    sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
                    sa.Column('sms_sender', sa.String(length=11), nullable=False),
                    sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False),
                    sa.Column('is_default', sa.Boolean(), nullable=False),
                    sa.Column('inbound_number_id', postgresql.UUID(as_uuid=True), nullable=True),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.ForeignKeyConstraint(['inbound_number_id'], ['inbound_numbers.id'], ),
                    sa.ForeignKeyConstraint(['service_id'], ['services.id'], ),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.create_index(op.f('ix_service_sms_senders_inbound_number_id'), 'service_sms_senders', ['inbound_number_id'],
                    unique=True)
    op.create_index(op.f('ix_service_sms_senders_service_id'), 'service_sms_senders', ['service_id'], unique=True)

    # populate govuk seeded service
    op.execute("""
        INSERT INTO service_sms_senders
        (id, sms_sender, service_id, is_default, inbound_number_id, created_at, updated_at)
        VALUES ('286d6176-adbe-7ea7-ba26-b7606ee5e2a4', 'GOVUK', 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553', true, null, now(), null)
    """) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:25,代码来源:0118_service_sms_senders.py

示例14: upgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def upgrade():
    op.create_index(op.f('ix_service_letter_contacts_service_id'), 'service_letter_contacts', ['service_id'],
                    unique=False)
    op.drop_index('ix_service_letter_contact_service_id', table_name='service_letter_contacts')
    op.create_index(op.f('ix_service_sms_senders_service_id'), 'service_sms_senders', ['service_id'], unique=False)
    op.execute(
        'ALTER TABLE templates_history ALTER COLUMN template_type TYPE template_type USING template_type::template_type')

    # new table
    op.create_table('notification_to_sms_sender',
    sa.Column('notification_id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('service_sms_sender_id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.ForeignKeyConstraint(['notification_id'], ['notifications.id'], ),
    sa.ForeignKeyConstraint(['service_sms_sender_id'], ['service_sms_senders.id'], ),
    sa.PrimaryKeyConstraint('notification_id', 'service_sms_sender_id')
    )
    op.create_index(op.f('ix_notification_to_sms_sender_notification_id'), 'notification_to_sms_sender', ['notification_id'], unique=True)
    op.create_index(op.f('ix_notification_to_sms_sender_service_sms_sender_id'), 'notification_to_sms_sender', ['service_sms_sender_id'], unique=False) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:20,代码来源:0128_noti_to_sms_sender.py

示例15: downgrade

# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import UUID [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint("fk_templates_created_by_id", 'templates', type_='foreignkey')
    op.drop_index(op.f('ix_templates_created_by_id'), table_name='templates')
    op.drop_column('templates', 'version')
    op.drop_column('templates', 'created_by_id')
    op.alter_column('api_keys_history', 'created_by_id',
               existing_type=postgresql.UUID(),
               nullable=True)
    op.alter_column('api_keys_history', 'created_at',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True)
    op.drop_index(op.f('ix_templates_history_service_id'), table_name='templates_history')
    op.drop_index(op.f('ix_templates_history_created_by_id'), table_name='templates_history')
    op.drop_table('templates_history')
    ### end Alembic commands ### 
开发者ID:alphagov,项目名称:notifications-api,代码行数:18,代码来源:0007_template_history.py


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