本文整理匯總了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)
)