moj-analytical-services / etl_manager

A python package to create a database on the platform using our moj data warehousing framework
21 stars 9 forks source link

Partitions as last columns is not persistent #91

Closed isichei closed 5 years ago

isichei commented 5 years ago

Partition columns in the TableMeta object should always be at the end of columns list. When partitions property of object is set columns are correctly re-ordered. But this is not the case when a partition is set and then further columns are added later.

Example:

from etl_manager.meta import TableMeta
tb = TableMeta(name='test', location='test')

tb.add_column('p', 'int', '')
tb.add_column('a', 'int', '')

tb.partitions = ['p']

tb.add_column('b', 'int', '')

print(tb.column_names) # ['a', 'p', 'b']