當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。