print BigQuery Unavailable msg if bigquery is not initialized
diff --git a/planetstack/hpc_wizard/planetstack_analytics.py b/planetstack/hpc_wizard/planetstack_analytics.py
index 3ba79a6..75462d4 100644
--- a/planetstack/hpc_wizard/planetstack_analytics.py
+++ b/planetstack/hpc_wizard/planetstack_analytics.py
@@ -1,4 +1,4 @@
-from bigquery_analytics import BigQueryAnalytics
+from bigquery_analytics import BigQueryAnalytics, BIGQUERY_AVAILABLE
import datetime
import re
import os
@@ -180,8 +180,13 @@
return value.split(",")
def format_result(self, format, result, query, dataSourceUrl):
+ if not BIGQUERY_AVAILABLE:
+ msg = "BigQuery Statistics Unavaiable"
+ else:
+ msg = None
+
if (format == "json_dicts"):
- result = {"query": query, "rows": result, "dataSourceUrl": dataSourceUrl}
+ result = {"query": query, "rows": result, "dataSourceUrl": dataSourceUrl, "msg": msg}
return ("application/javascript", json.dumps(result))
elif (format == "json_arrays"):
@@ -191,7 +196,7 @@
for key in sorted(row.keys()):
new_row.append(row[key])
new_result.append(new_row)
- new_result = {"query": query, "rows": new_result}
+ new_result = {"query": query, "rows": new_result, "msg": msg}
return ("application/javascript", json.dumps(new_result))
elif (format == "html_table"):