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


Python types.BigInteger方法代碼示例

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


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

示例1: get_type

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def get_type(data_type):
    type_map = {
        "bytes": types.LargeBinary,
        "boolean": types.Boolean,
        "date": types.Date,
        "datetime": types.DateTime,
        "double": types.Numeric,
        "text": types.String,
        "keyword": types.String,
        "integer": types.Integer,
        "half_float": types.Float,
        "geo_point": types.String,
        # TODO get a solution for nested type
        "nested": types.String,
        # TODO get a solution for object
        "object": types.BLOB,
        "long": types.BigInteger,
        "float": types.Float,
        "ip": types.String,
    }
    type_ = type_map.get(data_type)
    if not type_:
        logger.warning(f"Unknown type found {data_type} reverting to string")
        type_ = types.String
    return type_ 
開發者ID:preset-io,項目名稱:elasticsearch-dbapi,代碼行數:27,代碼來源:basesqlalchemy.py

示例2: _integer_compare

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def _integer_compare(t1, t2):
    t1_small_or_big = (
        'S' if isinstance(t1, sqltypes.SmallInteger)
        else 'B' if isinstance(t1, sqltypes.BigInteger) else 'I'
    )
    t2_small_or_big = (
        'S' if isinstance(t2, sqltypes.SmallInteger)
        else 'B' if isinstance(t2, sqltypes.BigInteger) else 'I'
    )
    return t1_small_or_big != t2_small_or_big 
開發者ID:jpush,項目名稱:jbox,代碼行數:12,代碼來源:impl.py

示例3: get_columns

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def get_columns(self, connection, table_name, schema=None, **kw):
        # Extend types supported by PrestoDialect as defined in PyHive
        type_map = {
            'bigint': sql_types.BigInteger,
            'integer': sql_types.Integer,
            'boolean': sql_types.Boolean,
            'double': sql_types.Float,
            'varchar': sql_types.String,
            'timestamp': sql_types.TIMESTAMP,
            'date': sql_types.DATE,
            'array<bigint>': sql_types.ARRAY(sql_types.Integer),
            'array<varchar>': sql_types.ARRAY(sql_types.String)
        }

        rows = self._get_table_columns(connection, table_name, schema)
        result = []
        for row in rows:
            try:
                coltype = type_map[row.Type]
            except KeyError:
                logger.warn("Did not recognize type '%s' of column '%s'" % (row.Type, row.Column))
                coltype = sql_types.NullType
            result.append({
                'name': row.Column,
                'type': coltype,
                # newer Presto no longer includes this column
                'nullable': getattr(row, 'Null', True),
                'default': None,
            })
        return result 
開發者ID:airbnb,項目名稱:omniduct,代碼行數:32,代碼來源:_schemas.py

示例4: new_wikipedia_tag

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def new_wikipedia_tag(self, languages):
        sitelinks = {code[:-4]: link['title']
                     for code, link in self.item.sitelinks().items()
                     if code.endswith('wiki')}

        for lang in languages:
            code = lang if isinstance(lang, str) else lang.wikimedia_language_code
            if code in sitelinks:
                return (code, sitelinks[code])
        return (None, None)

# class ItemCandidateTag(Base):
#     __tablename__ = 'item_candidate_tag'
#     __table_args__ = (
#         ForeignKeyConstraint(['item_id', 'osm_id', 'osm_type'],
#                              [ItemCandidate.item_id,
#                               ItemCandidate.osm_id,
#                               ItemCandidate.osm_type]),
#     )
#
#     item_id = Column(Integer, primary_key=True)
#     osm_id = Column(BigInteger, primary_key=True)
#     osm_type = Column(osm_type_enum, primary_key=True)
#     k = Column(String, primary_key=True)
#     v = Column(String, primary_key=True)
#
#     item_candidate = relationship(ItemCandidate,
#                                   backref=backref('tag_table', lazy='dynamic')) 
開發者ID:EdwardBetts,項目名稱:osm-wikidata,代碼行數:30,代碼來源:model.py

示例5: test_should_big_integer_convert_int

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def test_should_big_integer_convert_int():
    assert get_field(types.BigInteger()).type == graphene.Float 
開發者ID:graphql-python,項目名稱:graphene-sqlalchemy,代碼行數:4,代碼來源:test_converter.py

示例6: __repr__

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def __repr__(self):
        return 'BigInteger()' 
開發者ID:briancappello,項目名稱:flask-unchained,代碼行數:4,代碼來源:types.py

示例7: test_numeric

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def test_numeric(self):
        "Exercise type specification and options for numeric types."

        columns = [
            # column type, args, kwargs, expected ddl
            (types.NUMERIC, [], {}, "NUMERIC"),
            (types.NUMERIC, [None], {}, "NUMERIC"),
            (types.NUMERIC, [12, 4], {}, "NUMERIC(12, 4)"),
            (types.Float, [], {}, "FLOAT"),
            (types.Float, [None], {}, "FLOAT"),
            (types.Float, [12], {}, "FLOAT(12)"),
            (mssql.MSReal, [], {}, "REAL"),
            (types.Integer, [], {}, "INTEGER"),
            (types.BigInteger, [], {}, "BIGINT"),
            (mssql.MSTinyInteger, [], {}, "TINYINT"),
            (types.SmallInteger, [], {}, "SMALLINT"),
        ]

        metadata = MetaData()
        table_args = ["test_mssql_numeric", metadata]
        for index, spec in enumerate(columns):
            type_, args, kw, res = spec
            table_args.append(
                Column("c%s" % index, type_(*args, **kw), nullable=None)
            )

        numeric_table = Table(*table_args)
        dialect = mssql.dialect()
        gen = dialect.ddl_compiler(dialect, schema.CreateTable(numeric_table))

        for col in numeric_table.c:
            index = int(col.name[1:])
            testing.eq_(
                gen.get_column_specification(col),
                "%s %s" % (col.name, columns[index][3]),
            )
            self.assert_(repr(col)) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:39,代碼來源:test_types.py

示例8: __init__

# 需要導入模塊: from sqlalchemy import types [as 別名]
# 或者: from sqlalchemy.types import BigInteger [as 別名]
def __init__(self):
        self._types = {
            # Django internal type => SQLAlchemy type
            'ArrayField': SA_ARRAY,
            'AutoField': sa_types.Integer,
            'BigAutoField': sa_types.BigInteger,
            'BigIntegerField': sa_types.BigInteger,
            'BooleanField': sa_types.Boolean,
            'CharField': sa_types.String,
            'DateField': sa_types.Date,
            'DateTimeField': sa_types.DateTime,
            'DecimalField': sa_types.Numeric,
            'DurationField': sa_types.Interval,
            'FileField': sa_types.String,
            'FilePathField': sa_types.String,
            'FloatField': sa_types.Float,
            'GenericIPAddressField': sa_types.String,
            'IntegerField': sa_types.Integer,
            'JSONField': SA_JSONB,
            'NullBooleanField': sa_types.Boolean,
            'PointField': Geometry,
            'PositiveIntegerField': sa_types.Integer,
            'PositiveSmallIntegerField': sa_types.SmallInteger,
            'SlugField': sa_types.String,
            'SmallIntegerField': sa_types.SmallInteger,
            'TextField': sa_types.Text,
            'TimeField': sa_types.Time,
            'UUIDField': SA_UUID,
            # TODO: Add missing GIS fields
        } 
開發者ID:dvhb,項目名稱:dvhb-hybrid,代碼行數:32,代碼來源:convert.py


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