mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-22 00:56:34 +03:00
Minor fixes
This commit is contained in:
parent
c23947c28f
commit
0a94ac98a3
|
@ -87,10 +87,12 @@ class ModelBase(type):
|
|||
if db_type.startswith('FixedString'):
|
||||
length = int(db_type[12 : -1])
|
||||
return orm_fields.FixedStringField(length)
|
||||
# Decimal
|
||||
# Decimal / Decimal32 / Decimal64 / Decimal128
|
||||
if db_type.startswith('Decimal'):
|
||||
precision, scale = [int(n.strip()) for n in db_type[8 : -1].split(',')]
|
||||
return orm_fields.DecimalField(precision, scale)
|
||||
p = db_type.index('(')
|
||||
args = [int(n.strip()) for n in db_type[p + 1 : -1].split(',')]
|
||||
field_class = getattr(orm_fields, db_type[:p] + 'Field')
|
||||
return field_class(*args)
|
||||
# Nullable
|
||||
if db_type.startswith('Nullable'):
|
||||
inner_field = cls.create_ad_hoc_field(db_type[9 : -1])
|
||||
|
|
|
@ -351,7 +351,7 @@ class QuerySet(object):
|
|||
- `offset_limit`: either an integer specifying the limit, or a tuple of integers (offset, limit).
|
||||
- `fields`: the field names to use in the clause.
|
||||
"""
|
||||
if isinstance(offset_limit, six.integer_types):
|
||||
if isinstance(offset_limit, int):
|
||||
# Single limit
|
||||
offset_limit = (0, offset_limit)
|
||||
offset = offset_limit[0]
|
||||
|
|
|
@ -215,6 +215,4 @@ class DatabaseTestCase(TestCaseWithData):
|
|||
from infi.clickhouse_orm.models import ModelBase
|
||||
query = "SELECT DISTINCT type FROM system.columns"
|
||||
for row in self.database.select(query):
|
||||
if row.type in ('IPv4', 'IPv6'):
|
||||
continue # unsupported yet
|
||||
ModelBase.create_ad_hoc_field(row.type)
|
||||
|
|
|
@ -307,7 +307,7 @@ class FuncsTestCase(TestCaseWithData):
|
|||
try:
|
||||
self._test_func(F.base64Decode(F.base64Encode('Hello')), 'Hello')
|
||||
self._test_func(F.tryBase64Decode(F.base64Encode('Hello')), 'Hello')
|
||||
self._test_func(F.tryBase64Decode('zzz'), None)
|
||||
self._test_func(F.tryBase64Decode(':-)'), None)
|
||||
except ServerError as e:
|
||||
# ClickHouse version that doesn't support these functions
|
||||
raise unittest.SkipTest(e.message)
|
||||
|
|
Loading…
Reference in New Issue
Block a user