diff --git a/database/actions.py b/database/actions.py index ec5302f7d724d88701d1d71db429b48cb4bee23d..8563824fc5be33af513216ba5f938d02f317f2ea 100644 --- a/database/actions.py +++ b/database/actions.py @@ -53,6 +53,7 @@ def temporary_data(connection, file_name, table, year, offset=2, table.populate_temporary(ttable, file_name, header, year, delimiters, null, offset, bind=connection) table.apply_derivatives(ttable, ttable.columns.keys(), year, bind=connection) + table.add_pk_to_temporary(ttable, bind=connection) return ttable diff --git a/database/database_table.py b/database/database_table.py index 8d0c6389e770ce8b167bede6f0f83c77f526f109..67aee660624b38b3346da0b11ea689d7ac8274f9 100644 --- a/database/database_table.py +++ b/database/database_table.py @@ -908,10 +908,13 @@ class DatabaseTable(Table): ''' if bind is None: bind = self.metadata.bind - + for original in columns: self._resolv_derivative(original, year) + if (len(self._derivatives) == 0): + return; + max_level = max([self._derivatives[d]['level'] for d in self._derivatives]) for i in range(1, max_level + 1):