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


Python sqlalchemy.INT属性代码示例

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


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

示例1: define_temp_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_temp_tables(cls, metadata):
        kw = temp_table_keyword_args(config, config.db)
        user_tmp = Table(
            "user_tmp",
            metadata,
            Column("id", sa.INT, primary_key=True),
            Column("name", sa.VARCHAR(50)),
            Column("foo", sa.INT),
            sa.UniqueConstraint("name", name="user_tmp_uq"),
            sa.Index("user_tmp_ix", "foo"),
            **kw
        )
        if (
            testing.requires.view_reflection.enabled
            and testing.requires.temporary_views.enabled
        ):
            event.listen(
                user_tmp,
                "after_create",
                DDL(
                    "create temporary view user_tmp_v as "
                    "select * from user_tmp"
                ),
            )
            event.listen(user_tmp, "before_drop", DDL("drop view user_tmp_v")) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:27,代码来源:test_reflection.py

示例2: define_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_tables(cls, metadata):
        Table(
            "users",
            metadata,
            Column("user_id", INT, primary_key=True, autoincrement=False),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        )
        Table(
            "users_autoinc",
            metadata,
            Column(
                "user_id", INT, primary_key=True, test_needs_autoincrement=True
            ),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:19,代码来源:test_execute.py

示例3: test_rollback_deadlock

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def test_rollback_deadlock(self):
        """test that returning connections to the pool clears any object
        locks."""

        conn1 = testing.db.connect()
        conn2 = testing.db.connect()
        users = Table(
            "deadlock_users",
            metadata,
            Column("user_id", INT, primary_key=True),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        )
        users.create(conn1)
        conn1.exec_driver_sql("select * from deadlock_users")
        conn1.close()

        # without auto-rollback in the connection pool's return() logic,
        # this deadlocks in PostgreSQL, because conn1 is returned to the
        # pool but still has a lock on "deadlock_users". comment out the
        # rollback in pool/ConnectionFairy._close() to see !

        users.drop(conn2)
        conn2.close() 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:26,代码来源:test_transaction.py

示例4: define_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_tables(cls, metadata):
        Table(
            "users",
            metadata,
            Column("user_id", INT, primary_key=True, autoincrement=False),
            Column("user_name", VARCHAR(20)),
            Column("x", Integer),
            Column("y", Integer),
            test_needs_acid=True,
        )
        Table(
            "users_autoinc",
            metadata,
            Column(
                "user_id", INT, primary_key=True, test_needs_autoincrement=True
            ),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:21,代码来源:test_resultset.py

示例5: define_temp_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_temp_tables(cls, metadata):
        # cheat a bit, we should fix this with some dialect-level
        # temp table fixture
        if testing.against("oracle"):
            kw = {
                'prefixes': ["GLOBAL TEMPORARY"],
                'oracle_on_commit': 'PRESERVE ROWS'
            }
        else:
            kw = {
                'prefixes': ["TEMPORARY"],
            }

        user_tmp = Table(
            "user_tmp", metadata,
            Column("id", sa.INT, primary_key=True),
            Column('name', sa.VARCHAR(50)),
            Column('foo', sa.INT),
            sa.UniqueConstraint('name', name='user_tmp_uq'),
            sa.Index("user_tmp_ix", "foo"),
            **kw
        )
        if testing.requires.view_reflection.enabled and \
                testing.requires.temporary_views.enabled:
            event.listen(
                user_tmp, "after_create",
                DDL("create temporary view user_tmp_v as "
                    "select * from user_tmp")
            )
            event.listen(
                user_tmp, "before_drop",
                DDL("drop view user_tmp_v")
            ) 
开发者ID:jpush,项目名称:jbox,代码行数:35,代码来源:test_reflection.py

示例6: define_temp_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_temp_tables(cls, metadata):
        # the definition of temporary tables in the temporary table tests needs to be overwritten,
        # because similar to oracle, in HANA one needs to mention GLOBAL or LOCAL in the temporary table definition

        if testing.against("hana"):
            kw = {
                'prefixes': ["GLOBAL TEMPORARY"],
            }
        else:
            kw = {
                'prefixes': ["TEMPORARY"],
            }

        user_tmp = Table(
            "user_tmp", metadata,
            Column("id", sa.INT, primary_key=True),
            Column('name', sa.VARCHAR(50)),
            Column('foo', sa.INT),
            sa.UniqueConstraint('name', name='user_tmp_uq'),
            sa.Index("user_tmp_ix", "foo"),
            **kw
        )
        if testing.requires.view_reflection.enabled and \
                testing.requires.temporary_views.enabled:
            event.listen(
                user_tmp, "after_create",
                DDL("create temporary view user_tmp_v as "
                    "select * from user_tmp")
            )
            event.listen(
                user_tmp, "before_drop",
                DDL("drop view user_tmp_v")
            ) 
开发者ID:SAP,项目名称:sqlalchemy-hana,代码行数:35,代码来源:test_suite.py

示例7: define_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_tables(cls, metadata):
        Table(
            "users",
            metadata,
            Column("user_id", INT, primary_key=True, autoincrement=False),
            Column("user_name", VARCHAR(20)),
        )
        Table(
            "users_autoinc",
            metadata,
            Column(
                "user_id", INT, primary_key=True, test_needs_autoincrement=True
            ),
            Column("user_name", VARCHAR(20)),
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:17,代码来源:test_deprecations.py

示例8: setup_class

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def setup_class(cls):
        global users, metadata
        metadata = MetaData(testing.db)
        users = Table(
            "users",
            metadata,
            Column(
                "user_id", INT, primary_key=True, test_needs_autoincrement=True
            ),
            Column("user_name", VARCHAR(20)),
            Column("extra_data", VARCHAR(20)),
        )
        metadata.create_all() 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:15,代码来源:test_execute.py

示例9: setup_class

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def setup_class(cls):
        global users, metadata
        metadata = MetaData()
        users = Table(
            "query_users",
            metadata,
            Column("user_id", INT, primary_key=True),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        )
        users.create(testing.db) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:13,代码来源:test_transaction.py

示例10: setup_class

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def setup_class(cls):
        global users, users2, addresses, metadata
        metadata = MetaData(testing.db)
        users = Table(
            "query_users",
            metadata,
            Column(
                "user_id", INT, primary_key=True, test_needs_autoincrement=True
            ),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        )
        addresses = Table(
            "query_addresses",
            metadata,
            Column(
                "address_id",
                Integer,
                primary_key=True,
                test_needs_autoincrement=True,
            ),
            Column("user_id", Integer, ForeignKey("query_users.user_id")),
            Column("address", String(30)),
            test_needs_acid=True,
        )

        users2 = Table(
            "u2",
            metadata,
            Column("user_id", INT, primary_key=True),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        )

        metadata.create_all() 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:37,代码来源:test_query.py

示例11: define_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_tables(cls, metadata):
        Table(
            "users",
            metadata,
            Column(
                "user_id", INT, primary_key=True, test_needs_autoincrement=True
            ),
            Column("user_name", VARCHAR(20)),
            test_needs_acid=True,
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:12,代码来源:test_insert_exec.py

示例12: define_reflected_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_reflected_tables(cls, metadata, schema):
        if schema:
            schema_prefix = schema + "."
        else:
            schema_prefix = ""

        if testing.requires.self_referential_foreign_keys.enabled:
            users = Table('users', metadata,
                          Column('user_id', sa.INT, primary_key=True),
                          Column('test1', sa.CHAR(5), nullable=False),
                          Column('test2', sa.Float(5), nullable=False),
                          Column('parent_user_id', sa.Integer,
                                 sa.ForeignKey('%susers.user_id' %
                                               schema_prefix)),
                          schema=schema,
                          test_needs_fk=True,
                          )
        else:
            users = Table('users', metadata,
                          Column('user_id', sa.INT, primary_key=True),
                          Column('test1', sa.CHAR(5), nullable=False),
                          Column('test2', sa.Float(5), nullable=False),
                          schema=schema,
                          test_needs_fk=True,
                          )

        Table("dingalings", metadata,
              Column('dingaling_id', sa.Integer, primary_key=True),
              Column('address_id', sa.Integer,
                     sa.ForeignKey('%semail_addresses.address_id' %
                                   schema_prefix)),
              Column('data', sa.String(30)),
              schema=schema,
              test_needs_fk=True,
              )
        Table('email_addresses', metadata,
              Column('address_id', sa.Integer),
              Column('remote_user_id', sa.Integer,
                     sa.ForeignKey(users.c.user_id)),
              Column('email_address', sa.String(20)),
              sa.PrimaryKeyConstraint('address_id', name='email_ad_pk'),
              schema=schema,
              test_needs_fk=True,
              )

        if testing.requires.index_reflection.enabled:
            cls.define_index(metadata, users)
        if testing.requires.view_column_reflection.enabled:
            cls.define_views(metadata, schema)
        if not schema and testing.requires.temp_table_reflection.enabled:
            cls.define_temp_tables(metadata) 
开发者ID:jpush,项目名称:jbox,代码行数:53,代码来源:test_reflection.py

示例13: define_reflected_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_reflected_tables(cls, metadata, schema):
        if schema:
            schema_prefix = schema + "."
        else:
            schema_prefix = ""

        if testing.requires.self_referential_foreign_keys.enabled:
            users = Table('users', metadata,
                          Column('user_id', sa.INT, primary_key=True),
                          Column('test1', sa.CHAR(5), nullable=False),
                          Column('test2', sa.Float(5), nullable=False),
                          Column('parent_user_id', sa.Integer,
                                 sa.ForeignKey('%susers.user_id' %
                                               schema_prefix)),
                          schema=schema,
                          test_needs_fk=True,
                          )
        else:
            users = Table('users', metadata,
                          Column('user_id', sa.INT, primary_key=True),
                          Column('test1', sa.CHAR(5), nullable=False),
                          Column('test2', sa.Float(5), nullable=False),
                          schema=schema,
                          test_needs_fk=True,
                          )

        Table("dingalings", metadata,
              Column('dingaling_id', sa.Integer, primary_key=True),
              Column('address_id', sa.Integer,
                     sa.ForeignKey('%semail_addresses.address_id' %
                                   schema_prefix)),
              Column('data', sa.String(30)),
              schema=schema,
              test_needs_fk=True,
              )
        Table('email_addresses', metadata,
              Column('address_id', sa.Integer),
              Column('remote_user_id', sa.Integer,
                     sa.ForeignKey(users.c.user_id)),
              Column('email_address', sa.String(20)),
              sa.PrimaryKeyConstraint('address_id', name='email_ad_pk'),
              schema=schema,
              test_needs_fk=True,
              )

        if testing.requires.index_reflection.enabled:
            cls.define_index(metadata, users)
        if testing.requires.view_column_reflection.enabled:
            cls.define_views(metadata, schema) 
开发者ID:gltn,项目名称:stdm,代码行数:51,代码来源:test_reflection.py

示例14: define_tables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def define_tables(cls, metadata):
        Table(
            "users",
            metadata,
            Column(
                "user_id",
                sa.Integer,
                sa.Sequence("user_id_seq", optional=True),
                primary_key=True,
            ),
            Column("user_name", sa.String(40)),
        )

        Table(
            "email_addresses",
            metadata,
            Column(
                "address_id",
                sa.Integer,
                sa.Sequence("address_id_seq", optional=True),
                primary_key=True,
            ),
            Column("user_id", sa.Integer, sa.ForeignKey("users.user_id")),
            Column("email_address", sa.String(40)),
        )

        Table(
            "orders",
            metadata,
            Column(
                "order_id",
                sa.Integer,
                sa.Sequence("order_id_seq", optional=True),
                primary_key=True,
            ),
            Column("user_id", sa.Integer, sa.ForeignKey("users.user_id")),
            Column("description", sa.String(50)),
            Column("isopen", sa.Integer),
        )
        Table(
            "items",
            metadata,
            Column(
                "item_id",
                sa.INT,
                sa.Sequence("items_id_seq", optional=True),
                primary_key=True,
            ),
            Column("order_id", sa.INT, sa.ForeignKey("orders")),
            Column("item_name", sa.VARCHAR(50)),
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:53,代码来源:test_reflection.py

示例15: createTables

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import INT [as 别名]
def createTables(meta, schema=None):
    if schema:
        schema_prefix = schema + "."
    else:
        schema_prefix = ""

    users = Table(
        "users",
        meta,
        Column("user_id", sa.INT, primary_key=True),
        Column("user_name", sa.VARCHAR(20), nullable=False),
        Column("test1", sa.CHAR(5), nullable=False),
        Column("test2", sa.Float(5), nullable=False),
        Column("test3", sa.Text),
        Column("test4", sa.Numeric(10, 2), nullable=False),
        Column("test5", sa.Date),
        Column(
            "parent_user_id",
            sa.Integer,
            sa.ForeignKey("%susers.user_id" % schema_prefix),
        ),
        Column("test6", sa.Date, nullable=False),
        Column("test7", sa.Text),
        Column("test8", sa.LargeBinary),
        Column("test_passivedefault2", sa.Integer, server_default="5"),
        Column("test9", sa.LargeBinary(100)),
        Column("test10", sa.Numeric(10, 2)),
        schema=schema,
        test_needs_fk=True,
    )
    dingalings = Table(
        "dingalings",
        meta,
        Column("dingaling_id", sa.Integer, primary_key=True),
        Column(
            "address_id",
            sa.Integer,
            sa.ForeignKey("%semail_addresses.address_id" % schema_prefix),
        ),
        Column("data", sa.String(30)),
        schema=schema,
        test_needs_fk=True,
    )
    addresses = Table(
        "email_addresses",
        meta,
        Column("address_id", sa.Integer),
        Column("remote_user_id", sa.Integer, sa.ForeignKey(users.c.user_id)),
        Column("email_address", sa.String(20)),
        sa.PrimaryKeyConstraint("address_id", name="email_ad_pk"),
        schema=schema,
        test_needs_fk=True,
    )

    return (users, addresses, dingalings) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:57,代码来源:test_reflection.py


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