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


Python types.REAL属性代码示例

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


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

示例1: _type_affinity_fixture

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import REAL [as 别名]
def _type_affinity_fixture(self):
        return [
            ("LONGTEXT", sqltypes.TEXT()),
            ("TINYINT", sqltypes.INTEGER()),
            ("MEDIUMINT", sqltypes.INTEGER()),
            ("INT2", sqltypes.INTEGER()),
            ("UNSIGNED BIG INT", sqltypes.INTEGER()),
            ("INT8", sqltypes.INTEGER()),
            ("CHARACTER(20)", sqltypes.TEXT()),
            ("CLOB", sqltypes.TEXT()),
            ("CLOBBER", sqltypes.TEXT()),
            ("VARYING CHARACTER(70)", sqltypes.TEXT()),
            ("NATIVE CHARACTER(70)", sqltypes.TEXT()),
            ("BLOB", sqltypes.BLOB()),
            ("BLOBBER", sqltypes.NullType()),
            ("DOUBLE PRECISION", sqltypes.REAL()),
            ("FLOATY", sqltypes.REAL()),
            ("SOMETHING UNKNOWN", sqltypes.NUMERIC()),
        ] 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:21,代码来源:test_sqlite.py

示例2: sqltype_to_stdtype

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import REAL [as 别名]
def sqltype_to_stdtype(sqltype):
    import sqlalchemy.types as sqltypes
    if isinstance(sqltype, (sqltypes.VARCHAR, sqltypes.CHAR, sqltypes.TEXT, sqltypes.Enum, sqltypes.String)):
        return _STRING_TYPE
    if isinstance(sqltype, (sqltypes.DATETIME, sqltypes.DATE, sqltypes.TIME, sqltypes.TIMESTAMP)):
        return _DATE_TYPE
    if isinstance(sqltype, (sqltypes.INTEGER, sqltypes.BIGINT, sqltypes.SMALLINT, sqltypes.Integer)):
        return _INTEGER_TYPE
    if isinstance(sqltype, (sqltypes.REAL, sqltypes.DECIMAL, sqltypes.NUMERIC, sqltypes.FLOAT)):
        return _DECIMAL_TYPE
    if isinstance(sqltype, sqltypes.BOOLEAN):
        return _BOOLEAN_TYPE 
开发者ID:bailaohe,项目名称:parade,代码行数:14,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import REAL [as 别名]
def __init__(self, precision=None, scale=None, asdecimal=True, **kw):
        if isinstance(self, (REAL, DOUBLE)) and \
            (
                (precision is None and scale is not None) or
                (precision is not None and scale is None)
            ):
            raise exc.ArgumentError(
                "You must specify both precision and scale or omit "
                "both altogether.")

        super(_FloatType, self).__init__(precision=precision,
                                         asdecimal=asdecimal, **kw)
        self.scale = scale 
开发者ID:gltn,项目名称:stdm,代码行数:15,代码来源:base.py

示例4: migrate_table

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import REAL [as 别名]
def migrate_table(db, logger):
    old_table = Table(
        'quote',
        database.metadata,
        Column('chan', String(25)),
        Column('nick', String(25)),
        Column('add_nick', String(25)),
        Column('msg', String(500)),
        Column('time', REAL),
        Column('deleted', String(5), default=0),
        PrimaryKeyConstraint('chan', 'nick', 'time')
    )

    if not old_table.exists():
        database.metadata.remove(old_table)
        return

    old_quotes = db.execute(old_table.select()).fetchall()

    if not old_quotes:
        return

    logger.info("Migrating quotes table")
    qtable.drop(checkfirst=True)
    qtable.create(checkfirst=True)

    db.execute(qtable.insert().values([
        {
            'chan': row['chan'],
            'nick': row['nick'],
            'add_nick': row['add_nick'],
            'msg': row['msg'],
            'time': row['time'],
            'deleted': row['deleted'] in (1, '1', True)
        } for row in old_quotes
    ]))

    logger.info("Migrated all quotes")

    db.commit()
    old_table.drop()
    database.metadata.remove(old_table) 
开发者ID:TotallyNotRobots,项目名称:CloudBot,代码行数:44,代码来源:quote.py


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