Delimited file

Create a CSV database which can be used by param to get and run param sets.

class dapt.db.delimited_file.Delimited_file(path, delimiter=', ')

Bases: dapt.db.base.Database

An interface for accessing and setting paramater set data.

Parameters:path (string) – path to delimited file file
connect()

This method isn’t required for Delimeted files as there is nothing to connect to. It will return True regardless.

Returns:True if the database connected successfully and False otherwise.
get_keys()

Get the keys of the paramater set

Returns:Array of strings with each element being a key (order is preserved if possible)
get_row_index(column_key, row_value)

Get the row index given the column to look through and row value to match to.

Parameters:
  • column_key (str) – the column to use.
  • row_value (str) – the row value to match with in the file and determin the row index.
Returns:

The index or -1 if it could not be determined

get_table()

Get the table from the database.

Returns:An array with each element being a dictionary of the key-value pairs for the row in the database.
update_cell(row_index, key, value)

Get the keys of the paramater set

Parameters:
  • row_index (int) – the row id to replace
  • key (str) – the key of the value to replace
  • value (str) – the value to insert into the cell
Returns:

A boolean that is True if successfully inserted and False otherwise.

update_row(row_index, values)

Get the keys of the paramater set

Parameters:
  • row_index (int) – the index of the row to replace
  • values (Dict) – the key-value pairs that should be inserted
Returns:

A boolean that is True if successfully inserted and False otherwise.