Skip to content

Commit

Permalink
Fix the problem when executing fill_table twice
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasFehring committed Feb 14, 2024
1 parent d49cb40 commit e4e4909
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions py_experimenter/database_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ def _compute_columns(keyfields, resultfields):
)

def _exclude_fixed_columns(self, columns: List[str]) -> List[str]:
amount_of_keyfields = len(utils.get_keyfield_names(self.config))
amount_of_result_fields = len(utils.get_result_field_names(self.config))

if self.timestamp_on_result_fields:
amount_of_result_fields *= 2

return columns[1:amount_of_keyfields + 1] + columns[-amount_of_result_fields - 2:-2]
columns.remove('ID')
columns.remove('status')
columns.remove('creation_date')
columns.remove('start_date')
columns.remove('name')
columns.remove('machine')
columns.remove('end_date')
columns.remove('error')
return columns

def _create_table(self, cursor, columns: List[Tuple['str']], table_name: str, table_type: str = 'standard'):
query = self._get_create_table_query(columns, table_name, table_type)
Expand Down

0 comments on commit e4e4909

Please sign in to comment.