Skip to content

Commit

Permalink
Fix mysql conenctor
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasFehring committed Jan 9, 2024
1 parent 831f96c commit 058319c
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions py_experimenter/database_connector_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,11 @@ def _pull_open_experiment(self) -> Tuple[int, List, List]:
return experiment_id, description, values

def _get_existing_rows(self, column_names):
def _remove_double_whitespaces(existing_rows):
return [" ".join(row.split()) for row in existing_rows]

def _remove_string_markers(existing_rows):
return [row.replace("'", "") for row in existing_rows]

connection = self.connect()
cursor = self.cursor(connection)
self.execute(cursor, f"SELECT {','.join(column_names)} FROM {self.database_configuration.table_name}")
existing_rows = list(map(np.array2string, np.array(self.fetchall(cursor))))
existing_rows = _remove_string_markers(existing_rows)
existing_rows = _remove_double_whitespaces(existing_rows)
self.close_connection(connection)
return [dict(zip(column_names, existing_row)) for existing_row in existing_rows]
values = self.fetchall(cursor)
return [dict(zip(column_names, existing_row)) for existing_row in values]

def get_structure_from_table(self, cursor):
def _get_column_names_from_entries(entries):
Expand Down

0 comments on commit 058319c

Please sign in to comment.