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


Python sqlalchemy.Text方法代码示例

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


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

示例1: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    op.create_table(
        'container_actions_events',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('event', sa.String(length=255), nullable=True),
        sa.Column('action_id', sa.Integer(), nullable=False),
        sa.Column('start_time', sa.DateTime(), nullable=True),
        sa.Column('finish_time', sa.DateTime(), nullable=True),
        sa.Column('result', sa.String(length=255), nullable=True),
        sa.Column('traceback', sa.Text(), nullable=True),
        sa.Column('details', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(['action_id'], ['container_actions.id'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
开发者ID:openstack,项目名称:zun,代码行数:18,代码来源:b6bfca998431_add_container_actions_events_table.py

示例2: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('task_result',
    sa.Column('updated', sa.DateTime(), nullable=True),
    sa.Column('created', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pull_mirror_id', sa.Integer(), nullable=True),
    sa.Column('push_mirror_id', sa.Integer(), nullable=True),
    sa.Column('task_id', sa.String(length=155), nullable=True),
    sa.Column('status', sa.String(length=50), nullable=True),
    sa.Column('task_name', sa.String(length=255), nullable=True),
    sa.Column('invoked_by', sa.Integer(), nullable=True),
    sa.Column('result', sa.PickleType(), nullable=True),
    sa.Column('date_done', sa.DateTime(), nullable=True),
    sa.Column('traceback', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['pull_mirror_id'], ['pull_mirror.id'], ),
    sa.ForeignKeyConstraint(['push_mirror_id'], ['push_mirror.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('task_id')
    )
    op.create_index(op.f('ix_task_result_pull_mirror_id'), 'task_result', ['pull_mirror_id'], unique=False)
    op.create_index(op.f('ix_task_result_push_mirror_id'), 'task_result', ['push_mirror_id'], unique=False)
    # ### end Alembic commands ### 
开发者ID:Salamek,项目名称:gitlab-tools,代码行数:25,代码来源:20bcb4b2673c_.py

示例3: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('apple_subscription',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('expires_date', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False),
    sa.Column('original_transaction_id', sa.String(length=256), nullable=False),
    sa.Column('receipt_data', sa.Text(), nullable=False),
    sa.Column('plan', sa.Enum('monthly', 'yearly', name='planenum_apple'), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id')
    )
    op.alter_column('file', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    # ### end Alembic commands ### 
开发者ID:simple-login,项目名称:app,代码行数:21,代码来源:2020_041911_dd911f880b75_.py

示例4: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('client',
    sa.Column('id', sa.String(length=255), nullable=False),
    sa.Column('homeserver', sa.String(length=255), nullable=False),
    sa.Column('access_token', sa.Text(), nullable=False),
    sa.Column('enabled', sa.Boolean(), nullable=False),
    sa.Column('next_batch', sa.String(length=255), nullable=False),
    sa.Column('filter_id', sa.String(length=255), nullable=False),
    sa.Column('sync', sa.Boolean(), nullable=False),
    sa.Column('autojoin', sa.Boolean(), nullable=False),
    sa.Column('displayname', sa.String(length=255), nullable=False),
    sa.Column('avatar_url', sa.String(length=255), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('plugin',
    sa.Column('id', sa.String(length=255), nullable=False),
    sa.Column('type', sa.String(length=255), nullable=False),
    sa.Column('enabled', sa.Boolean(), nullable=False),
    sa.Column('primary_user', sa.String(length=255), nullable=False),
    sa.Column('config', sa.Text(), nullable=False),
    sa.ForeignKeyConstraint(['primary_user'], ['client.id'], onupdate='CASCADE', ondelete='RESTRICT'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ### 
开发者ID:maubot,项目名称:maubot,代码行数:27,代码来源:d295f8dcfa64_initial_revision.py

示例5: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    op.create_table(
        'error_logs',
        IDColumn(),
        sa.Column('created_at', sa.DateTime(timezone=True),
                  server_default=sa.func.now(), index=True),
        sa.Column('severity', sa.Enum('critical', 'error', 'warning', 'info', 'debug', name='errorlog_severity'),
                  index=True),
        sa.Column('source', sa.String),
        sa.Column('user', GUID, sa.ForeignKey('users.uuid'), nullable=True, index=True),
        sa.Column('is_read', sa.Boolean, default=False, index=True),
        sa.Column('is_cleared', sa.Boolean, default=False, index=True),
        sa.Column('message', sa.Text),
        sa.Column('context_lang', sa.String),
        sa.Column('context_env', postgresql.JSONB()),
        sa.Column('request_url', sa.String, nullable=True),
        sa.Column('request_status', sa.Integer, nullable=True),
        sa.Column('traceback', sa.Text, nullable=True),
    ) 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:21,代码来源:d2aafa234374_create_error_logs_table.py

示例6: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('domains', sa.Column('integration_id', sa.String(length=512), nullable=True))
    op.alter_column('domains', 'total_resource_slots',
                    existing_type=postgresql.JSONB(astext_type=sa.Text()),
                    nullable=True)
    op.add_column('groups', sa.Column('integration_id', sa.String(length=512), nullable=True))
    op.add_column('groups', sa.Column('total_resource_slots',
                                      postgresql.JSONB(astext_type=sa.Text()), nullable=True))
    op.add_column('users', sa.Column('integration_id', sa.String(length=512), nullable=True))
    # ### end Alembic commandk ###

    print('\nSet group\'s total_resource_slots with empty dictionary.')
    query = textwrap.dedent('''\
        UPDATE groups SET total_resource_slots = '{}'::jsonb;
    ''')
    connection = op.get_bind()
    connection.execute(query) 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:20,代码来源:22964745c12b_add_total_resource_slots_to_group.py

示例7: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    ''' Adjust the status column of the pull_requests table.
    '''
    op.add_column(
        'pull_requests',
        sa.Column(
            '_status', sa.Text,
            sa.ForeignKey(
                'status_pull_requests.status', onupdate='CASCADE'),
            default='Open',
            nullable=True)
    )

    op.execute('''UPDATE "pull_requests" '''
               '''SET _status='Open' WHERE status=TRUE;''')
    op.execute('''UPDATE "pull_requests" '''
               '''SET _status='Merged' WHERE status=FALSE;''')

    op.drop_column('pull_requests', 'status')
    op.alter_column(
        'pull_requests',
        column_name='_status', new_column_name='status',
        nullable=False, existing_nullable=True) 
开发者ID:Pagure,项目名称:pagure,代码行数:25,代码来源:298891e63039_change_the_status_of_pull_requests.py

示例8: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('nu_outbound_wrappers', sa.Column('actual_target', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('client_id', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('client_key', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('groupinfo', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('outbound_wrapper', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('referrer', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('releaseinfo', sa.Text(), nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('seriesname', sa.Text(), nullable=True))
    op.create_index(op.f('ix_nu_outbound_wrappers_client_id'), 'nu_outbound_wrappers', ['client_id'], unique=False)
    op.create_index(op.f('ix_nu_outbound_wrappers_client_key'), 'nu_outbound_wrappers', ['client_key'], unique=False)
    op.create_index(op.f('ix_nu_outbound_wrappers_groupinfo'), 'nu_outbound_wrappers', ['groupinfo'], unique=False)
    op.create_index(op.f('ix_nu_outbound_wrappers_seriesname'), 'nu_outbound_wrappers', ['seriesname'], unique=False)
    op.drop_index('ix_nu_outbound_wrappers_container_page', table_name='nu_outbound_wrappers')
    op.drop_index('ix_nu_outbound_wrappers_link_url', table_name='nu_outbound_wrappers')
    op.drop_column('nu_outbound_wrappers', 'container_page')
    op.drop_column('nu_outbound_wrappers', 'link_url')
    op.drop_column('nu_outbound_wrappers', 'target_url')
    ### end Alembic commands ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:22,代码来源:00007_cb674b790e4a_more_nu_stuff.py

示例9: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('key_value_store',
        sa.Column('id', sa.BigInteger(), nullable=False),
        sa.Column('key', sa.Text(), nullable=False),
        sa.Column('value', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )

    print("Creating index")
    op.create_index(op.f('ix_key_value_store_key'), 'key_value_store', ['key'], unique=True)
    print("Applying not-null constraing")
    op.alter_column('nu_release_item', 'release_date',
               existing_type=postgresql.TIMESTAMP(),
               nullable=False)
    # ### end Alembic commands ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:18,代码来源:00042_49308bd51717_kvstore_table.py

示例10: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chart_block_defaults',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=False),
    sa.Column('caption', sa.String(length=255), nullable=True),
    sa.Column('slug', sa.String(length=255), nullable=False),
    sa.Column('dataset', sa.String(length=255), nullable=False),
    sa.Column('content', sa.Text(convert_unicode=True), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('chart_blocks',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('department_id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=255), nullable=False),
    sa.Column('caption', sa.String(length=255), nullable=True),
    sa.Column('slug', sa.String(length=255), nullable=False),
    sa.Column('dataset', sa.String(length=255), nullable=False),
    sa.Column('content', sa.Text(), nullable=True),
    sa.Column('date_updated', sa.DateTime(), nullable=True),
    sa.Column('date_edited', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['department_id'], ['departments.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('use_of_force_incidents', sa.Column('received_date', sa.DateTime(), nullable=True))
    ### end Alembic commands ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:28,代码来源:4ffa73ef2b8_.py

示例11: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('departments', sa.Column('contact_us', sa.Text(convert_unicode=True), nullable=True))
    op.add_column('departments', sa.Column('how_you_can_use_this_data', sa.Text(convert_unicode=True), nullable=True))
    op.add_column('departments', sa.Column('what_this_is', sa.Text(convert_unicode=True), nullable=True))
    op.add_column('departments', sa.Column('why_we_are_doing_this', sa.Text(convert_unicode=True), nullable=True))
    ### end Alembic commands ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:9,代码来源:1d31622bbed_.py

示例12: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    resource_type = sa.Table(
        'resource_type', sa.MetaData(),
        sa.Column('name', sa.String(255), nullable=False),
        sa.Column('attributes', sa.Text, nullable=False)
    )

    for name, attributes in legacy.ceilometer_resources.items():
        text_attributes = json.dumps(attributes)
        op.execute(resource_type.update().where(
            resource_type.c.name == name
        ).values({resource_type.c.attributes: text_attributes})) 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:14,代码来源:8f376189b9eb_migrate_legacy_resources_to_db.py

示例13: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def upgrade():
    bind = op.get_bind()

    resource_type = sa.Table(
        'resource_type', sa.MetaData(),
        sa.Column('name', sa.String(255), nullable=False),
        sa.Column('tablename', sa.String(18), nullable=False),
        sa.Column('attributes', sa.Text, nullable=False)
    )

    # NOTE(gordc): fix for incorrect migration:
    # 0718ed97e5b3_add_tablename_to_resource_type.py#L46
    op.execute(resource_type.update().where(
        resource_type.c.name == "instance_network_interface"
    ).values({'tablename': 'instance_net_int'}))

    resource_type_names = [rt.name for rt in
                           list(bind.execute(resource_type.select()))]

    for name, attributes in legacy.ceilometer_resources.items():
        if name in resource_type_names:
            continue
        tablename = legacy.ceilometer_tablenames.get(name, name)
        text_attributes = json.dumps(attributes)
        op.execute(resource_type.insert().values({
            resource_type.c.attributes: text_attributes,
            resource_type.c.name: name,
            resource_type.c.tablename: tablename,
        })) 
开发者ID:gnocchixyz,项目名称:gnocchi,代码行数:31,代码来源:ffc7bbeec0b0_migrate_legacy_resources_to_db2.py

示例14: MediumText

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def MediumText():
    return Text().with_variant(MEDIUMTEXT(), 'mysql') 
开发者ID:openstack,项目名称:zun,代码行数:4,代码来源:models.py

示例15: MediumText

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def MediumText():
    return sa.Text().with_variant(sa.dialects.mysql.MEDIUMTEXT(), 'mysql') 
开发者ID:openstack,项目名称:zun,代码行数:4,代码来源:47d79ffdc582_add_cni_metadata_to_container.py


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