diff --git a/VERSION b/VERSION index 227cea2..38f77a6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.0 +2.0.1 diff --git a/exabel_data_sdk/scripts/csv_script_with_entity_mapping.py b/exabel_data_sdk/scripts/csv_script_with_entity_mapping.py index af7dc9c..b0880b2 100644 --- a/exabel_data_sdk/scripts/csv_script_with_entity_mapping.py +++ b/exabel_data_sdk/scripts/csv_script_with_entity_mapping.py @@ -48,7 +48,7 @@ def __init__(self, argv: Sequence[str], description: str): "Supports *.json and *.csv extensions only." ) self.parser.add_argument( - "--entity_mapping_filename", required=False, type=str, help=help_text + "--entity-mapping-filename", required=False, type=str, help=help_text ) def read_entity_mapping_file( diff --git a/exabel_data_sdk/scripts/get_time_series.py b/exabel_data_sdk/scripts/get_time_series.py index f056815..e7e5c48 100644 --- a/exabel_data_sdk/scripts/get_time_series.py +++ b/exabel_data_sdk/scripts/get_time_series.py @@ -38,7 +38,7 @@ def __init__(self, argv: Sequence[str]): help="The last date of the time series", ) self.parser.add_argument( - "--known_time", + "--known-time", required=False, type=str, help="The point-in-time to retrieve the time series at", diff --git a/exabel_data_sdk/scripts/load_entities_from_csv.py b/exabel_data_sdk/scripts/load_entities_from_csv.py index dd7786d..59ee011 100644 --- a/exabel_data_sdk/scripts/load_entities_from_csv.py +++ b/exabel_data_sdk/scripts/load_entities_from_csv.py @@ -15,7 +15,7 @@ class LoadEntitiesFromCsv(CsvScript): The CSV file should have a header line specifying the column names. - The command line argument --name_column specifies the column from which to read + The command line argument --name-column specifies the column from which to read the entity names. The entity names are automatically normalized to create a valid resource name for the entity. @@ -30,28 +30,28 @@ class LoadEntitiesFromCsv(CsvScript): def __init__(self, argv: Sequence[str], description: str): super().__init__(argv, description) self.parser.add_argument( - "--entity_type", + "--entity-type", required=False, type=str, help="The type of the entities to be loaded. Must already exist in the data model. " "If not specified, defaults to the same value as the name_column argument.", ) self.parser.add_argument( - "--name_column", + "--name-column", required=False, type=str, help="The column name for the entity name. " "If not specified, defaults to the first column in the file.", ) self.parser.add_argument( - "--display_name_column", + "--display-name-column", required=False, type=str, help="The column name for the entity's display name. " "If not specified, uses the entity name", ) self.parser.add_argument( - "--description_column", + "--description-column", required=False, type=str, help="The column name for the entity description. " diff --git a/exabel_data_sdk/scripts/load_relationships_from_csv.py b/exabel_data_sdk/scripts/load_relationships_from_csv.py index 5440f1d..4c252fd 100644 --- a/exabel_data_sdk/scripts/load_relationships_from_csv.py +++ b/exabel_data_sdk/scripts/load_relationships_from_csv.py @@ -16,7 +16,7 @@ class LoadRelationshipsFromCsv(CsvScriptWithEntityMapping): The CSV file should have a header line specifying the column names. - The command line arguments --entity_from_column and --entity_to_column specify the columns + The command line arguments --entity-from-column and --entity-to-column specify the columns in which the related entities are given. The entity names are automatically normalized to form the corresponding resource names (consistently with the load_entities_from_csv script). @@ -32,34 +32,34 @@ class LoadRelationshipsFromCsv(CsvScriptWithEntityMapping): Beyond Meat,Beyond Burger,Plant-based patties which would be loaded by specifying: - --relationship_type my_namespace.HAS_PRODUCT - --entity_from_column brand - --entity_to_column product - --description_column description + --relationship-type my_namespace.HAS_PRODUCT + --entity-from-column brand + --entity-to-column product + --description-column description """ def __init__(self, argv: Sequence[str], description: str): super().__init__(argv, description) self.parser.add_argument( - "--relationship_type", + "--relationship-type", required=True, type=str, help="The type of the relationships to be loaded. Created if it doesn't already exist.", ) self.parser.add_argument( - "--entity_from_column", + "--entity-from-column", required=True, type=str, help="The column name for the entity from which the relationship originates.", ) self.parser.add_argument( - "--entity_to_column", + "--entity-to-column", required=True, type=str, help="The column name for the entity name to which the relationship goes.", ) self.parser.add_argument( - "--description_column", + "--description-column", required=False, type=str, help="The column name for the relationship description. " diff --git a/exabel_data_sdk/scripts/load_time_series_from_csv.py b/exabel_data_sdk/scripts/load_time_series_from_csv.py index 8c14784..8c6a142 100644 --- a/exabel_data_sdk/scripts/load_time_series_from_csv.py +++ b/exabel_data_sdk/scripts/load_time_series_from_csv.py @@ -42,14 +42,14 @@ def __init__(self, argv: Sequence[str]): description = "Upload timeseries file." super().__init__(argv, description) self.parser.add_argument( - "--create_missing_signals", + "--create-missing-signals", required=False, action="store_true", default=False, help="Automatically create signals that are not already present in the API.", ) self.parser.add_argument( - "--pit_current_time", + "--pit-current-time", required=False, action="store_true", default=False, @@ -57,14 +57,14 @@ def __init__(self, argv: Sequence[str]): "the time at which it is inserted into the Exabel system.", ) self.parser.add_argument( - "--pit_offset", + "--pit-offset", required=False, type=int, choices=range(31), metavar="[0-30]", help="Set the Known-Time of the uploaded data to be the timestamp of each data point, " "plus the specified number of days as an offset. For instance, if the data is " - "available to the user the day after, one would set --pit_offset 1", + "available to the user the day after, one would set --pit-offset 1", ) @staticmethod diff --git a/exabel_data_sdk/tests/scripts/test_csv_script_with_entity_mapping.py b/exabel_data_sdk/tests/scripts/test_csv_script_with_entity_mapping.py index 6869b38..0e53ebc 100644 --- a/exabel_data_sdk/tests/scripts/test_csv_script_with_entity_mapping.py +++ b/exabel_data_sdk/tests/scripts/test_csv_script_with_entity_mapping.py @@ -25,7 +25,7 @@ def run_script(self, client: ExabelClient, args: argparse.Namespace) -> None: class TestCsvScriptWithEntitySearch(unittest.TestCase): def test_read_entity_mapping_file_json(self): args = common_args + [ - "--entity_mapping_filename", + "--entity-mapping-filename", "./exabel_data_sdk/tests/resources/data/entity_mapping.json", ] @@ -39,7 +39,7 @@ def test_read_entity_mapping_file_json(self): def test_read_entity_mapping_file_csv(self): args = common_args + [ - "--entity_mapping_filename", + "--entity-mapping-filename", "./exabel_data_sdk/tests/resources/data/entity_mapping.csv", ] @@ -53,7 +53,7 @@ def test_read_entity_mapping_file_csv(self): def test_should_fail_read_entity_mapping_file_invalid_csv(self): args = common_args + [ - "--entity_mapping_filename", + "--entity-mapping-filename", "./exabel_data_sdk/tests/resources/data/entity_mapping_invalid.csv", ] @@ -68,7 +68,7 @@ def test_should_fail_read_entity_mapping_file_invalid_json(self): ] for file in files: - args = common_args + ["--entity_mapping_filename", file] + args = common_args + ["--entity-mapping-filename", file] loader = ConcreteCsvScriptWithEntitySearch(args, "Load") with self.assertRaises(SystemExit): loader.read_entity_mapping_file(loader.parse_arguments()) @@ -81,7 +81,7 @@ def test_should_fail_read_entity_mapping_file_invalid_extension(self): ] for file in files: - args = common_args + ["--entity_mapping_filename", file] + args = common_args + ["--entity-mapping-filename", file] loader = ConcreteCsvScriptWithEntitySearch(args, "Load") with self.assertRaises(SystemExit): loader.read_entity_mapping_file(loader.parse_arguments()) diff --git a/exabel_data_sdk/tests/scripts/test_load_entities_from_csv.py b/exabel_data_sdk/tests/scripts/test_load_entities_from_csv.py index a5c5b99..0839cbf 100644 --- a/exabel_data_sdk/tests/scripts/test_load_entities_from_csv.py +++ b/exabel_data_sdk/tests/scripts/test_load_entities_from_csv.py @@ -19,7 +19,7 @@ def test_read_file(self): args = common_args + [ "--filename", "./exabel_data_sdk/tests/resources/data/entities.csv", - "--description_col", + "--description-col", "description", ] client = load_test_data_from_csv(LoadEntitiesFromCsv, args) @@ -42,7 +42,7 @@ def test_read_file_with_integer_identifier(self): "--filename", "./exabel_data_sdk/tests/resources/data/entities_with_integer_identifiers.csv", ] - extra_args = [[], ["--name_column", "brand"]] + extra_args = [[], ["--name-column", "brand"]] expected_entities = [ Entity(name="entityTypes/brand/entities/test.0001", display_name="0001"), Entity(name="entityTypes/brand/entities/test.0002", display_name="0002"), diff --git a/exabel_data_sdk/tests/scripts/test_load_relationships_from_csv.py b/exabel_data_sdk/tests/scripts/test_load_relationships_from_csv.py index a8bffd9..904ea7a 100644 --- a/exabel_data_sdk/tests/scripts/test_load_relationships_from_csv.py +++ b/exabel_data_sdk/tests/scripts/test_load_relationships_from_csv.py @@ -11,9 +11,9 @@ "acme", "--api-key", "123", - "--relationship_type", + "--relationship-type", "PART_OF", - "--entity_to_column", + "--entity-to-column", "brand", ] @@ -23,9 +23,9 @@ def test_read_file(self): args = common_args + [ "--filename", "./exabel_data_sdk/tests/resources/data/relationships.csv", - "--entity_from_column", + "--entity-from-column", "entity_from", - "--description_column", + "--description-column", "description", ] client = load_test_data_from_csv(LoadRelationshipsFromCsv, args) @@ -54,7 +54,7 @@ def test_read_file_with_integer_identifiers(self): args = common_args + [ "--filename", "./exabel_data_sdk/tests/resources/data/relationships_with_integer_identifiers.csv", - "--entity_from_column", + "--entity-from-column", "company", ] client = load_test_data_from_csv(LoadRelationshipsFromCsv, args) diff --git a/exabel_data_sdk/tests/scripts/test_load_time_series_from_csv.py b/exabel_data_sdk/tests/scripts/test_load_time_series_from_csv.py index a364075..762f770 100644 --- a/exabel_data_sdk/tests/scripts/test_load_time_series_from_csv.py +++ b/exabel_data_sdk/tests/scripts/test_load_time_series_from_csv.py @@ -101,7 +101,7 @@ def test_read_file_use_header_for_signal(self): "./exabel_data_sdk/tests/resources/data/timeseries.csv", "--namespace", "", - "--pit_current_time", + "--pit-current-time", ] script = LoadTimeSeriesFromCsv(args) @@ -138,7 +138,7 @@ def test_read_file_with_multiple_signals(self): "./exabel_data_sdk/tests/resources/data/timeseries_multiple_signals.csv", "--namespace", "acme", - "--pit_offset", + "--pit-offset", "0", ] script = LoadTimeSeriesFromCsv(args) @@ -249,7 +249,7 @@ def test_read_file_with_integer_identifiers(self): "./exabel_data_sdk/tests/resources/data/timeseries_with_integer_identifiers.csv", "--namespace", "acme", - "--pit_offset", + "--pit-offset", "30", ]