Spine-Toolbox icon indicating copy to clipboard operation
Spine-Toolbox copied to clipboard

Spine DB support for more delimiters

Open tltoni opened this issue 3 years ago • 1 comments

Request: Support for other delimiters like comma if we copy-paste tables to Spine DB.

Currently tab is used as a delimiter for copy pasting values to tables in Spine DB. For example, in the tutorial this is extensively used, see: https://spine-toolbox.readthedocs.io/en/latest/case_study_a5.html

The issue is that tabs are treated differently in different text editors and other software. A more robust way would be to support also other delimiters, e.g. comma. In this case copy-pasting would be possible from comma separated value (CSV) files, which would be more robust. An example of this issue is that .rst don't support tabs, hence, the given tutorial examples all copy pasting from tables must happen by including external text files in order for copy pasting to work. Additionally, it's difficult if not impossible to nicely align a table with entries of different lengths by using tabs.

Below is a part of table that the user is required to copy

Rebnis_pwr_plant Rebnis_upper Sadva_pwr_plant Sadva_upper Bergnäs_pwr_plant Bergnäs_upper Slagnäs_pwr_plant Slagnäs_upper

Here copy pasting works, but the table looks weird. A support for other delimiters like comma would resolve the issue, e.g. if copy pasting of the following would work: Rebnis_pwr_plant , Rebnis_upper Sadva_pwr_plant , Sadva_upper Bergnäs_pwr_plant , Bergnäs_upper Slagnäs_pwr_plant , Slagnäs_upper

Note, it seems that the above shown example does not work because tabs and spaces are removed. However, this emphasis the issue that relying on tabs when copy pasting tables is not a robust way to go.

For convenience a spine model example is attached.

Case Study A5.zip

tltoni avatar Mar 12 '21 16:03 tltoni

We could try to use csv package's Sniffer to autodetect the 'dialect'.

soininen avatar Feb 07 '23 14:02 soininen