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


Python mysql.TINYINT属性代码示例

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


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

示例1: test_change_deleted_column_type_to_boolean_with_fc

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def test_change_deleted_column_type_to_boolean_with_fc(self):
        expected_types = {'mysql': mysql.TINYINT,
                          'ibm_db_sa': SmallInteger}
        table_name_1 = 'abc'
        table_name_2 = 'bcd'

        table_1 = Table(table_name_1, self.meta,
                        Column('id', Integer, primary_key=True),
                        Column('deleted', Integer))
        table_1.create()

        table_2 = Table(table_name_2, self.meta,
                        Column('id', Integer, primary_key=True),
                        Column('foreign_id', Integer,
                               ForeignKey('%s.id' % table_name_1)),
                        Column('deleted', Integer))
        table_2.create()

        utils.change_deleted_column_type_to_boolean(self.engine, table_name_2)

        table = utils.get_table(self.engine, table_name_2)
        self.assertIsInstance(table.c.deleted.type,
                              expected_types.get(self.engine.name, Boolean)) 
开发者ID:openstack,项目名称:oslo.db,代码行数:25,代码来源:test_utils.py

示例2: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('templates',
        sa.Column('template_name', sa.String(length=50), nullable=False),
        sa.Column('template', mysql.TEXT(), nullable=False),
        sa.Column('is_modified', mysql.TINYINT(), nullable=False),
        sa.PrimaryKeyConstraint('template_name')
    )
    # ### end Alembic commands ### 
开发者ID:RiotGames,项目名称:cloud-inquisitor,代码行数:11,代码来源:a2e49567641a_add_templates_table.py

示例3: test_boolean_detection

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def test_boolean_detection(metadata):
    Table(
        "simple_items",
        metadata,
        Column("bool1", INTEGER),
        Column("bool2", SMALLINT),
        Column("bool3", mysql.TINYINT),
        CheckConstraint("simple_items.bool1 IN (0, 1)"),
        CheckConstraint("simple_items.bool2 IN (0, 1)"),
        CheckConstraint("simple_items.bool3 IN (0, 1)"),
    )

    assert (
        generate_code(metadata)
        == """\
# coding: utf-8
from sqlalchemy import Boolean, Column, MetaData, Table

metadata = MetaData()


t_simple_items = Table(
    'simple_items', metadata,
    Column('bool1', Boolean),
    Column('bool2', Boolean),
    Column('bool3', Boolean)
)
"""
    ) 
开发者ID:thomaxxl,项目名称:safrs,代码行数:31,代码来源:test_codegen.py

示例4: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def upgrade():
    op.add_column(
        'repos',
        sa.Column('worth', mysql.TINYINT(display_width=1), server_default='3', nullable=False)
    )
    op.create_index(op.f('ix_repos_worth'), 'repos', ['worth'], unique=False) 
开发者ID:kkamkou,项目名称:gitmostwanted.com,代码行数:8,代码来源:590104e559b_worth_column_in_repos.py

示例5: test_change_deleted_column_type_to_boolean

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def test_change_deleted_column_type_to_boolean(self):
        expected_types = {'mysql': mysql.TINYINT,
                          'ibm_db_sa': SmallInteger}
        table_name = 'abc'
        table = Table(table_name, self.meta,
                      Column('id', Integer, primary_key=True),
                      Column('deleted', Integer))
        table.create()

        utils.change_deleted_column_type_to_boolean(self.engine, table_name)

        table = utils.get_table(self.engine, table_name)
        self.assertIsInstance(table.c.deleted.type,
                              expected_types.get(self.engine.name, Boolean)) 
开发者ID:openstack,项目名称:oslo.db,代码行数:16,代码来源:test_utils.py

示例6: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('backup', sa.Column('extension', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.drop_constraint(op.f('fk_backup_creator_id_user'), 'backup', type_='foreignkey')
    op.drop_column('backup', 'custom_submission_time')
    op.drop_column('backup', 'creator_id')
    ### end Alembic commands ### 
开发者ID:okpy,项目名称:ok,代码行数:9,代码来源:7e1d5c529924_custom_submission_times_for_backup.py

示例7: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('match', sa.Column('playout_enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('match', sa.Column('overtime_enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    ### end Alembic commands ### 
开发者ID:splewis,项目名称:get5-web,代码行数:7,代码来源:8bc3fc909d1a_.py

示例8: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def downgrade():
    op.add_column('tag', sa.Column(u'user_mutable',
                                   mysql.TINYINT(display_width=1),
                                   server_default='1', nullable=False)) 
开发者ID:nylas,项目名称:sync-engine,代码行数:6,代码来源:042_simplify_tags_schema.py

示例9: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def downgrade():
    op.add_column('account', sa.Column('save_raw_messages',
                                       mysql.TINYINT(display_width=1),
                                       server_default='1', nullable=True)) 
开发者ID:nylas,项目名称:sync-engine,代码行数:6,代码来源:202_drop_sync_raw_data_column.py

示例10: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('cosmetics', 'css',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.alter_column('guild_members', 'active',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guild_members', 'banned',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('guilds', 'bracket_links',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'channels',
               existing_type=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('guilds', 'chat_links',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'emojis',
               existing_type=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('guilds', 'roles',
               existing_type=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('guilds', 'unauth_users',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'visitor_view',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.alter_column('guilds', 'webhooks',
               existing_type=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('unauthenticated_users', 'revoked',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('user_css', 'css',
               existing_type=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=True)
    # ### end Alembic commands ### 
开发者ID:TitanEmbeds,项目名称:Titan,代码行数:63,代码来源:40cbd3e0f22d_moved_some_text_columns_to_longtext_type.py

示例11: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user_css', 'css',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('unauthenticated_users', 'revoked',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('guilds', 'webhooks',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'visitor_view',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    op.alter_column('guilds', 'unauth_users',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'roles',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'emojis',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'chat_links',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'channels',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'bracket_links',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guild_members', 'banned',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('guild_members', 'active',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('cosmetics', 'css',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    # ### end Alembic commands ### 
开发者ID:TitanEmbeds,项目名称:Titan,代码行数:63,代码来源:40cbd3e0f22d_moved_some_text_columns_to_longtext_type.py

示例12: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TINYINT [as 别名]
def downgrade():
    op.create_table(
        'lens',
        sa.Column('public_id', sa.BINARY(length=16), nullable=False),
        sa.Column('created_at', mysql.DATETIME(), nullable=False),
        sa.Column('updated_at', mysql.DATETIME(), nullable=False),
        sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
        sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
        sa.Column('namespace_id', mysql.INTEGER(display_width=11),
                  autoincrement=False, nullable=False),
        sa.Column('subject', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('thread_public_id', sa.BINARY(length=16), nullable=True),
        sa.Column('started_before', mysql.DATETIME(), nullable=True),
        sa.Column('started_after', mysql.DATETIME(), nullable=True),
        sa.Column('last_message_before', mysql.DATETIME(), nullable=True),
        sa.Column('last_message_after', mysql.DATETIME(), nullable=True),
        sa.Column('any_email', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('to_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('from_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('cc_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('bcc_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('filename', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('tag', mysql.VARCHAR(length=255), nullable=True),
        sa.ForeignKeyConstraint(['namespace_id'], [u'namespace.id'],
                                name=u'lens_ibfk_1', ondelete=u'CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        mysql_default_charset=u'utf8mb4',
        mysql_engine=u'InnoDB'
    )
    op.create_table(
        'webhook',
        sa.Column('public_id', sa.BINARY(length=16), nullable=False),
        sa.Column('created_at', mysql.DATETIME(), nullable=False),
        sa.Column('updated_at', mysql.DATETIME(), nullable=False),
        sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
        sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
        sa.Column('namespace_id', mysql.INTEGER(display_width=11),
                  autoincrement=False, nullable=False),
        sa.Column('lens_id', mysql.INTEGER(display_width=11),
                  autoincrement=False, nullable=False),
        sa.Column('callback_url', mysql.TEXT(), nullable=False),
        sa.Column('failure_notify_url', mysql.TEXT(), nullable=True),
        sa.Column('include_body', mysql.TINYINT(display_width=1),
                  autoincrement=False, nullable=False),
        sa.Column('max_retries', mysql.INTEGER(display_width=11),
                  server_default='3', autoincrement=False, nullable=False),
        sa.Column('retry_interval', mysql.INTEGER(display_width=11),
                  server_default='60', autoincrement=False, nullable=False),
        sa.Column('active', mysql.TINYINT(display_width=1), server_default='1',
                  autoincrement=False, nullable=False),
        sa.Column('min_processed_id', mysql.INTEGER(display_width=11),
                  server_default='0', autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(['lens_id'], [u'lens.id'],
                                name=u'webhook_ibfk_2', ondelete=u'CASCADE'),
        sa.ForeignKeyConstraint(['namespace_id'], [u'namespace.id'],
                                name=u'webhook_ibfk_1', ondelete=u'CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        mysql_default_charset=u'utf8mb4',
        mysql_engine=u'InnoDB'
    ) 
开发者ID:nylas,项目名称:sync-engine,代码行数:62,代码来源:091_remove_webhooks.py


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