Merge pull request #296 from conorreid/bigint_check
Add support for BigInteger
This commit is contained in:
commit
43e9431865
@ -27,7 +27,7 @@ class Types(object):
|
|||||||
if isinstance(sample, bool):
|
if isinstance(sample, bool):
|
||||||
return cls.boolean
|
return cls.boolean
|
||||||
elif isinstance(sample, int):
|
elif isinstance(sample, int):
|
||||||
return cls.integer
|
return cls.bigint
|
||||||
elif isinstance(sample, float):
|
elif isinstance(sample, float):
|
||||||
return cls.float
|
return cls.float
|
||||||
elif isinstance(sample, datetime):
|
elif isinstance(sample, datetime):
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from sqlalchemy import FLOAT, INTEGER, TEXT
|
from sqlalchemy import FLOAT, TEXT, BIGINT
|
||||||
from sqlalchemy.exc import IntegrityError, SQLAlchemyError, ArgumentError
|
from sqlalchemy.exc import IntegrityError, SQLAlchemyError, ArgumentError
|
||||||
|
|
||||||
from dataset import connect
|
from dataset import connect
|
||||||
@ -464,12 +464,20 @@ class TableTestCase(unittest.TestCase):
|
|||||||
tbl.table.c['bar'].type
|
tbl.table.c['bar'].type
|
||||||
tbl.create_column_by_example('bar', 1)
|
tbl.create_column_by_example('bar', 1)
|
||||||
assert 'bar' in tbl.table.c, tbl.table.c
|
assert 'bar' in tbl.table.c, tbl.table.c
|
||||||
assert isinstance(tbl.table.c['bar'].type, INTEGER), \
|
assert isinstance(tbl.table.c['bar'].type, BIGINT), \
|
||||||
tbl.table.c['bar'].type
|
tbl.table.c['bar'].type
|
||||||
tbl.create_column_by_example('pippo', 'test')
|
tbl.create_column_by_example('pippo', 'test')
|
||||||
assert 'pippo' in tbl.table.c, tbl.table.c
|
assert 'pippo' in tbl.table.c, tbl.table.c
|
||||||
assert isinstance(tbl.table.c['pippo'].type, TEXT), \
|
assert isinstance(tbl.table.c['pippo'].type, TEXT), \
|
||||||
tbl.table.c['pippo'].type
|
tbl.table.c['pippo'].type
|
||||||
|
tbl.create_column_by_example('bigbar', 11111111111)
|
||||||
|
assert 'bigbar' in tbl.table.c, tbl.table.c
|
||||||
|
assert isinstance(tbl.table.c['bigbar'].type, BIGINT), \
|
||||||
|
tbl.table.c['bigbar'].type
|
||||||
|
tbl.create_column_by_example('littlebar', -11111111111)
|
||||||
|
assert 'littlebar' in tbl.table.c, tbl.table.c
|
||||||
|
assert isinstance(tbl.table.c['littlebar'].type, BIGINT), \
|
||||||
|
tbl.table.c['littlebar'].type
|
||||||
|
|
||||||
def test_key_order(self):
|
def test_key_order(self):
|
||||||
res = self.db.query('SELECT temperature, place FROM weather LIMIT 1')
|
res = self.db.query('SELECT temperature, place FROM weather LIMIT 1')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user