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


Python mysql.SMALLINT属性代码示例

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


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

示例1: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import SMALLINT [as 别名]
def upgrade():
    op.create_table(
        'repos_stars',
        sa.Column('repo_id', sa.BigInteger(), nullable=False, primary_key=True),
        sa.Column('stars', mysql.SMALLINT(display_width=4, unsigned=True), nullable=False),
        sa.Column(
            'year',
            mysql.SMALLINT(display_width=4, unsigned=True),
            autoincrement=False, nullable=False, primary_key=True
        ),
        sa.Column(
            'day', mysql.SMALLINT(display_width=3, unsigned=True),
            autoincrement=False, nullable=False, primary_key=True
        ),
        sa.ForeignKeyConstraint(
            ['repo_id'], ['repos.id'], name='fk_repos_stars_repo_id', ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('repo_id', 'year', 'day')
    ) 
开发者ID:kkamkou,项目名称:gitmostwanted.com,代码行数:21,代码来源:4e0851c5f08_repo_stars_table.py

示例2: create_new_tables

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import SMALLINT [as 别名]
def create_new_tables():
    op.create_table('account_types',
        sa.Column('account_type_id', mysql.INTEGER(unsigned=True), nullable=False, autoincrement=True),
        sa.Column('account_type', sa.String(length=100), nullable=False),
        sa.PrimaryKeyConstraint('account_type_id')
    )
    op.create_index(op.f('ix_account_types_account_type'), 'account_types', ['account_type'], unique=True)

    op.create_table('accounts_new',
        sa.Column('account_id', mysql.INTEGER(unsigned=True), nullable=False),
        sa.Column('account_name', sa.String(length=256), nullable=False),
        sa.Column('account_type_id', mysql.INTEGER(unsigned=True), nullable=False),
        sa.Column('contacts', mysql.JSON(), nullable=False),
        sa.Column('enabled', mysql.SMALLINT(unsigned=True), nullable=False),
        sa.Column('required_roles', mysql.JSON(), nullable=True),
        sa.ForeignKeyConstraint(
            ('account_type_id',),
            ['account_types.account_type_id'],
            name='fk_account_account_type_id',
            ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('account_id')
    )
    op.create_index(op.f('ix_accounts_new_account_name'), 'accounts_new', ['account_name'], unique=True)
    op.create_index(op.f('ix_accounts_new_account_type_id'), 'accounts_new', ['account_type_id'], unique=False)

    op.create_table('account_properties',
        sa.Column('property_id', mysql.INTEGER(unsigned=True), nullable=False, autoincrement=True),
        sa.Column('account_id', mysql.INTEGER(unsigned=True), nullable=False),
        sa.Column('name', sa.String(length=50), nullable=False),
        sa.Column('value', mysql.JSON(), nullable=False),
        sa.ForeignKeyConstraint(
            ('account_id',),
            ['accounts_new.account_id'],
            name='fk_account_properties_account_id',
            ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('property_id', 'account_id')
    )
    op.create_index(op.f('ix_account_properties_account_id'), 'account_properties', ['account_id'], unique=False)
    op.create_index(op.f('ix_account_properties_name'), 'account_properties', ['name'], unique=False) 
开发者ID:RiotGames,项目名称:cloud-inquisitor,代码行数:43,代码来源:cfb0ed4cced9_new_accounts_table.py

示例3: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import SMALLINT [as 别名]
def upgrade():
    op.add_column(
        'repos',
        sa.Column('worth_max', SMALLINT(display_width=2), server_default='0', nullable=False)
    ) 
开发者ID:kkamkou,项目名称:gitmostwanted.com,代码行数:7,代码来源:286e2cdc37c9_worh_max_field.py


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