本文整理汇总了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')
)
示例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 ###
示例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 ###
示例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 ###
示例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),
)
示例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)
示例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)
示例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 ###
示例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 ###
示例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 ###
示例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 ###
示例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}))
示例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,
}))
示例14: MediumText
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def MediumText():
return Text().with_variant(MEDIUMTEXT(), 'mysql')
示例15: MediumText
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import Text [as 别名]
def MediumText():
return sa.Text().with_variant(sa.dialects.mysql.MEDIUMTEXT(), 'mysql')