diff --git a/prism/commands/tables_commands.py b/prism/commands/tables_commands.py index 4c76202..3c691c2 100644 --- a/prism/commands/tables_commands.py +++ b/prism/commands/tables_commands.py @@ -3,7 +3,7 @@ import sys import click -from prism import * +from prism import (schema_compact, load_schema, upload_file, truncate_table) logger = logging.getLogger("prismCLI") @@ -182,7 +182,7 @@ def tables_edit(ctx, file, truncate): table = p.tables_put(schema, truncate=truncate) if table is None: - logger.error(f"Error updating table.") + logger.error("Error updating table.") else: logger.info(json.dumps(table, indent=2)) diff --git a/prism/data/invalid-schema.json b/prism/data/invalid-schema.json deleted file mode 100644 index f95d6d2..0000000 --- a/prism/data/invalid-schema.json +++ /dev/null @@ -1 +0,0 @@ -{ "d" , "mem" } \ No newline at end of file diff --git a/prism/data/schema.csv b/prism/data/schema.csv deleted file mode 100644 index 3411907..0000000 --- a/prism/data/schema.csv +++ /dev/null @@ -1,6 +0,0 @@ -name,displayName,ordinal,type,businessObject,precision,scale,parseFormat,required,externalId -text_field, text field,,text -date_field, date field,,date,,,,MM/DD/yy -numeric_field, numeric field,,numeric,,19,3 -required_field,required field,,,,,,,true -external_field, external id,,,,,,,true,true \ No newline at end of file diff --git a/prism/prism.py b/prism/prism.py index 83748cc..558d09e 100644 --- a/prism/prism.py +++ b/prism/prism.py @@ -407,7 +407,7 @@ def create_bearer_token(self): self.bearer_token = r.json()["access_token"] self.bearer_token_timestamp = time.time() else: - logger.error(f"create bearer token failed: HTTP status code.") + # Error handling occurred in http_post, fail silently here. self.bearer_token = None self.bearer_token_timestamp = None @@ -918,7 +918,7 @@ def buckets_create( tables = self.tables_get(table_name=target_name, type_="full") if tables["total"] == 0: - logger.error(f"table not found for bucket operation.") + logger.error(f"table {target_name} not found for bucket operation.") return None table = tables["data"][0] @@ -940,7 +940,7 @@ def buckets_create( bucket_schema = table_to_bucket_schema(compact_schema) - logger.debug(f"post: /buckets") + logger.debug("post: /buckets") url = self.prism_endpoint + "/buckets" data = { @@ -984,7 +984,9 @@ def buckets_complete(self, bucket_id): logger.debug(f"successfully completed wBucket {bucket_id}.") return r.json() elif r.status_code == 400: - logger.debug(f"error completing bucket") + # This is an error coming back from the API call and + # is actually valid JSON with an "error" attribute. + logger.debug("non-fatal error completing bucket") return r.json() return None @@ -1241,7 +1243,7 @@ def dataChanges_activities_post(self, datachange_id, filecontainer_id=None): logger.debug(f"successfully started data load task - id: {activity_id}") return return_json elif r.status_code == 400: - logger.error(f"error running data change task.") + logger.error("error running data change task.") return r.json() # This is still valid JSON with the error. return None @@ -1535,7 +1537,7 @@ def truncate_table(p, table_id=None, table_name=None): bucket = p.buckets_create(target_name=table_name, operation="TruncateAndInsert") if bucket is None: - logger.error(f"Unable to truncate table - see log for details.") + logger.error("Unable to truncate table - see log for details.") return None bucket_id = bucket["id"] diff --git a/tests/test_prism.py b/tests/test_prism.py index d9793f9..80390af 100644 --- a/tests/test_prism.py +++ b/tests/test_prism.py @@ -2,5 +2,5 @@ def test_load_schema(schema_file): - schema = prism.load_schema(schema_file) + schema = prism.load_schema(file=schema_file) assert type(schema) is dict