This commit is contained in:
DimasKovas 2023-03-30 06:00:28 +00:00 committed by GitHub
commit 8e7536fb4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -224,7 +224,10 @@ class ModelBase(type):
# Tuples (poor man's version - convert to array)
if db_type.startswith('Tuple'):
types = [s.strip() for s in db_type[6 : -1].split(',')]
assert len(set(types)) == 1, 'No support for mixed types in tuples - ' + db_type
if len(types[0].split()) != 1:
raise NotImplementedError('No support for named tuples - %s' % db_type)
if len(set(types)) != 1:
raise NotImplementedError('No support for mixed types in tuples - %s' % db_type)
inner_field = cls.create_ad_hoc_field(types[0])
return orm_fields.ArrayField(inner_field)
# FixedString

View File

@ -254,6 +254,8 @@ class DatabaseTestCase(TestCaseWithData):
for row in self.database.select(query):
if row.type.startswith('Map'):
continue # Not supported yet
if 'Tuple' in row.type:
continue # Not fully supported yet
ModelBase.create_ad_hoc_field(row.type)
def test_get_model_for_table(self):