Python sqlalchemy.types.BigInteger() Examples
The following are 9
code examples of sqlalchemy.types.BigInteger().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sqlalchemy.types
, or try the search function
.
Example #1
Source File: impl.py From jbox with MIT License | 5 votes |
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
Example #2
Source File: _schemas.py From omniduct with MIT License | 5 votes |
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
Example #3
Source File: basesqlalchemy.py From elasticsearch-dbapi with Apache License 2.0 | 5 votes |
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_
Example #4
Source File: model.py From osm-wikidata with GNU General Public License v3.0 | 5 votes |
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'))
Example #5
Source File: test_converter.py From graphene-sqlalchemy with MIT License | 5 votes |
def test_should_big_integer_convert_int(): assert get_field(types.BigInteger()).type == graphene.Float
Example #6
Source File: types.py From flask-unchained with MIT License | 5 votes |
def __repr__(self): return 'BigInteger()'
Example #7
Source File: test_types.py From sqlalchemy with MIT License | 5 votes |
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))
Example #8
Source File: convert.py From dvhb-hybrid with MIT License | 5 votes |
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 }
Example #9
Source File: impl.py From android_universal with MIT License | 5 votes |
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