當前位置: 首頁>>代碼示例>>Python>>正文


Python sqlalchemy.Integer方法代碼示例

本文整理匯總了Python中sqlalchemy.Integer方法的典型用法代碼示例。如果您正苦於以下問題:Python sqlalchemy.Integer方法的具體用法?Python sqlalchemy.Integer怎麽用?Python sqlalchemy.Integer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sqlalchemy的用法示例。


在下文中一共展示了sqlalchemy.Integer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('citizen_complaint',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('department_id', sa.Integer(), nullable=False),
    sa.Column('opaque_id', sa.String(length=255), nullable=False),
    sa.Column('occured_date', sa.DateTime(), nullable=True),
    sa.Column('division', sa.String(length=255), nullable=True),
    sa.Column('precinct', sa.String(length=255), nullable=True),
    sa.Column('shift', sa.String(length=255), nullable=True),
    sa.Column('beat', sa.String(length=255), nullable=True),
    sa.Column('disposition', sa.String(length=255), nullable=True),
    sa.Column('census_tract', sa.String(length=255), nullable=True),
    sa.Column('resident_race', sa.String(length=255), nullable=True),
    sa.Column('officer_race', sa.String(length=255), nullable=True),
    sa.Column('resident_sex', sa.String(length=255), nullable=True),
    sa.Column('officer_sex', sa.String(length=255), nullable=True),
    sa.Column('officer_identifier', sa.String(length=255), nullable=True),
    sa.Column('officer_years_of_service', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['department_id'], ['departments.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('opaque_id')
    )
    ### end Alembic commands ### 
開發者ID:codeforamerica,項目名稱:comport,代碼行數:26,代碼來源:33fcc9c4867_.py

示例2: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'assaults_on_officers',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('department_id', sa.Integer(), nullable=False),
        sa.Column('opaque_id', sa.String(length=255), nullable=False),
        sa.Column('officer_identifier', sa.String(length=255), nullable=True),
        sa.Column('service_type', sa.String(length=255), nullable=True),
        sa.Column('force_type', sa.String(length=255), nullable=True),
        sa.Column('assignment', sa.String(length=255), nullable=True),
        sa.Column('arrest_made', sa.Boolean(), nullable=True),
        sa.Column('officer_injured', sa.Boolean(), nullable=True),
        sa.Column('officer_killed', sa.Boolean(), nullable=True),
        sa.Column('report_filed', sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(['department_id'], ['departments.id'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
開發者ID:codeforamerica,項目名稱:comport,代碼行數:19,代碼來源:720df9948a25_.py

示例3: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=80), nullable=False),
    sa.Column('email', sa.String(length=80), nullable=False),
    sa.Column('password', sa.String(length=128), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=False),
    sa.Column('first_name', sa.String(length=30), nullable=True),
    sa.Column('last_name', sa.String(length=30), nullable=True),
    sa.Column('active', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('username')
    )
    op.create_table('roles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=80), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ### 
開發者ID:codeforamerica,項目名稱:comport,代碼行數:25,代碼來源:52979aa7977_.py

示例4: revision

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def revision(cls):
        tablename_compact = cls.__tablename__
        if tablename_compact.endswith("_history"):
            tablename_compact = tablename_compact[:-6]
        return sqlalchemy.Column(
            sqlalchemy.Integer,
            sqlalchemy.ForeignKey(
                'resource_history.revision',
                ondelete="CASCADE",
                name="fk_%s_revision_rh_revision"
                % tablename_compact,
                # NOTE(sileht): We use to ensure that postgresql
                # does not use AccessExclusiveLock on destination table
                use_alter=True),
            primary_key=True
        ) 
開發者ID:gnocchixyz,項目名稱:gnocchi,代碼行數:18,代碼來源:sqlalchemy_base.py

示例5: check_and_upgrade_database

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def check_and_upgrade_database(self) -> None:
        row = self.Version.query.all()
        version = row[0].version if row else 1
        if version == LATEST_VERSION:
            return

        self.Version.query.delete()

        if version == 1:
            self.UpdateState.__table__.create(self.db_engine)
            version = 3
        elif version == 2:
            self._add_column(self.UpdateState, Column(type=Integer, name="unread_count"))

        self.db.add(self.Version(version=version))
        self.db.commit() 
開發者ID:tulir,項目名稱:telethon-session-sqlalchemy,代碼行數:18,代碼來源:sqlalchemy.py

示例6: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'network',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('uuid', sa.String(length=36), nullable=True),
        sa.Column('network_id', sa.String(length=255), nullable=True),
        sa.Column('neutron_net_id', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_network0uuid'),
        sa.UniqueConstraint('neutron_net_id',
                            name='uniq_network0neutron_net_id'),
        mysql_charset='utf8',
        mysql_engine='InnoDB'
        ) 
開發者ID:openstack,項目名稱:zun,代碼行數:21,代碼來源:3298c6a5c3d9_create_network_table.py

示例7: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'container_actions',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('action', sa.String(length=255), nullable=True),
        sa.Column('container_uuid', sa.String(length=36), nullable=False),
        sa.Column('request_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('start_time', sa.DateTime(), nullable=True),
        sa.Column('finish_time', sa.DateTime(), nullable=True),
        sa.Column('message', sa.String(length=255), nullable=True),
        sa.Index('container_uuid_idx', 'container_uuid'),
        sa.Index('request_id_idx', 'request_id'),
        sa.ForeignKeyConstraint(['container_uuid'], ['container.uuid'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:21,代碼來源:cf46a28f46bc_add_container_actions_table.py

示例8: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'capsule',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('capsule_version', sa.String(length=255), nullable=True),
        sa.Column('kind', sa.String(length=36), nullable=True),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('restart_policy', sa.String(length=255), nullable=True),
        sa.Column('host_selector', sa.String(length=255), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('uuid', sa.String(length=36), nullable=False),
        sa.Column('status', sa.String(length=255), nullable=True),
        sa.Column('status_reason', sa.Text(), nullable=True),
        sa.Column('message', models.JSONEncodedDict(), nullable=True),
        sa.Column('spec', models.JSONEncodedDict(), nullable=True),
        sa.Column('cpu', sa.Float(), nullable=True),
        sa.Column('memory', sa.String(length=255), nullable=True),
        sa.Column('meta_name', sa.String(length=255), nullable=True),
        sa.Column('meta_labels', models.JSONEncodedList(), nullable=True),
        sa.Column('containers_uuids', models.JSONEncodedList(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:26,代碼來源:a251f1f61217_create_capsule_table.py

示例9: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'allocation',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('resource_provider_id', sa.Integer(), nullable=False),
        sa.Column('consumer_id', sa.String(36), nullable=False),
        sa.Column('resource_class_id', sa.Integer(), nullable=False),
        sa.Column('used', sa.Integer(), nullable=False),
        sa.Column('is_nested', sa.Integer(), nullable=False),
        sa.Column('blob', zun.db.sqlalchemy.models.JSONEncodedList(),
                  nullable=True),
        sa.Index('allocation_resource_provider_class_used_idx',
                 'resource_provider_id', 'resource_class_id', 'used'),
        sa.Index('allocation_consumer_id_idx', 'consumer_id'),
        sa.Index('allocation_resource_class_id_idx', 'resource_class_id'),
        sa.PrimaryKeyConstraint('id'),
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:21,代碼來源:e4d145e195f4_create_allocation_table.py

示例10: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'container',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('uuid', sa.String(length=36), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('image', sa.String(length=255), nullable=True),
        sa.Column('command', sa.String(length=255), nullable=True),
        sa.Column('status', sa.String(length=20), nullable=True),
        sa.Column('environment', zun.db.sqlalchemy.models.JSONEncodedDict(),
                  nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_container0uuid')
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:20,代碼來源:9fe371393a24_create_table_container.py

示例11: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'exec_instance',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), primary_key=True, nullable=False),
        sa.Column('container_id', sa.Integer(), nullable=False),
        sa.Column('exec_id', sa.String(255), nullable=False),
        sa.Column('token', sa.String(255), nullable=True),
        sa.Column('url', sa.String(255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.ForeignKeyConstraint(['container_id'], ['container.id'],
                                ondelete='CASCADE'),
        sa.UniqueConstraint('container_id', 'exec_id',
                            name='uniq_exec_instance0container_id_exec_id'),
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:18,代碼來源:26896d5f9053_create_exec_instance_table.py

示例12: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'container_actions_events',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('event', sa.String(length=255), nullable=True),
        sa.Column('action_id', sa.Integer(), nullable=False),
        sa.Column('start_time', sa.DateTime(), nullable=True),
        sa.Column('finish_time', sa.DateTime(), nullable=True),
        sa.Column('result', sa.String(length=255), nullable=True),
        sa.Column('traceback', sa.Text(), nullable=True),
        sa.Column('details', sa.Text(), nullable=True),
        sa.ForeignKeyConstraint(['action_id'], ['container_actions.id'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:18,代碼來源:b6bfca998431_add_container_actions_events_table.py

示例13: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'volume_mapping',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('uuid', sa.String(36), nullable=False),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('volume_id', sa.String(36), nullable=False),
        sa.Column('volume_provider', sa.String(36), nullable=False),
        sa.Column('container_uuid', sa.String(36), nullable=False),
        sa.Column('container_path', sa.String(length=255), nullable=True),
        sa.Column('connection_info', MediumText(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_volume0uuid'),
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:19,代碼來源:10d65e285a59_create_volume_mapping_table.py

示例14: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'registry',
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('project_id', sa.String(length=255), nullable=True),
        sa.Column('user_id', sa.String(length=255), nullable=True),
        sa.Column('uuid', sa.String(length=36), nullable=True),
        sa.Column('name', sa.String(length=255), nullable=True),
        sa.Column('domain', sa.String(length=255), nullable=False),
        sa.Column('username', sa.String(length=255), nullable=True),
        sa.Column('password', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('uuid', name='uniq_registry0uuid'),
        mysql_charset='utf8',
        mysql_engine='InnoDB'
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:20,代碼來源:5ffc1cabe6b4_add_registry_table.py

示例15: upgrade

# 需要導入模塊: import sqlalchemy [as 別名]
# 或者: from sqlalchemy import Integer [as 別名]
def upgrade():
    op.create_table(
        'zun_service',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('created_at', sa.DateTime(), nullable=True),
        sa.Column('updated_at', sa.DateTime(), nullable=True),
        sa.Column('report_count', sa.Integer(), nullable=False),
        sa.Column('host', sa.String(length=255), nullable=True),
        sa.Column('binary', sa.String(length=255), nullable=True),
        sa.Column('disabled', sa.Boolean(), nullable=True),
        sa.Column('disabled_reason', sa.String(length=255), nullable=True),
        sa.Column('last_seen_up', sa.DateTime(), nullable=True),
        sa.Column('forced_down', sa.Boolean(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('host', 'binary',
                            name='uniq_zun_service0host0binary')
    ) 
開發者ID:openstack,項目名稱:zun,代碼行數:19,代碼來源:a9a92eebd9a8_create_table_zun_service.py


注:本文中的sqlalchemy.Integer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。