本文整理汇总了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')
)
示例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)
示例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)
)