Make sure these boxes are checked before submitting your issue - thank you!
0.31.1
Chart should render without error when metric is given a non-uppercase label.
Chart fails to render when metric is given a non-uppercase label.
Stacktrace is as follows:
Traceback (most recent call last):
File "/home/superset/superset/views/base.py", line 114, in wraps
return f(self, *args, **kwargs)
File "/home/superset/superset/views/core.py", line 1229, in explore_json
samples=samples,
File "/home/superset/superset/views/core.py", line 1160, in generate_json
payload = viz_obj.get_payload()
File "/home/superset/superset/viz.py", line 378, in get_payload
payload['data'] = self.get_data(df)
File "/home/superset/superset/viz.py", line 1231, in get_data
df = self.process_data(df)
File "/home/superset/superset/viz.py", line 1151, in process_data
values=self.metric_labels)
File "/usr/local/lib/python3.6/site-packages/pandas/core/frame.py", line 5303, in pivot_table
margins_name=margins_name)
File "/usr/local/lib/python3.6/site-packages/pandas/core/reshape/pivot.py", line 61, in pivot_table
raise KeyError(i)
KeyError: 'my label'
Query > Metrics in the chart UI.my label.I'm also faced with the same issue. I got the error message like this {"error": "'__timestamp'"} I think this problem is related to #4994 (Force lowercase column names for Snowflake and Oracle)
Snowflake returns all column names as upper case. If you run queries in the Snowflake web portal or on a console, they all return upper case columns.
Imho Snowflake should be able to deal with any column name, as long as it is quoted.
Thus I can imagine that forcing quotes on the column names may do the trick here.
@rumbin Did you try running a query with quoted columns in Snowflake? From what I remember, Snowflake does not keep the casing of names in quotes
@yuguang I have never worked with Snowflake. However, my suggestion is based on the docs:
https://docs.snowflake.net/manuals/sql-reference/identifiers-syntax.html
[...]
To support case-sensitive identifiers, as well as allowing identifiers to start with special characters and use extended characters (including blank spaces), identifiers can be enclosed in double quotes.
[...]
@rumbin I tried to rename columns by lowering the column names and putting double quotes " to them. (For example, the date column is renamed to "the_date") However, I still got the error message "error": "000904 (42000): 018bdaf9-03cf-51b6-0000-3a6d000435b6: SQL compilation error: error line 1 at position 25\ninvalid identifier 'THE_DATE'" It seems that Snowflake still defaults columns to uppercase.
@yuyuhan0306 Try adding {"connect_args": {"session_parameters": {"QUOTED_IDENTIFIERS_IGNORE_CASE": false}}} to the engine_params of the Snowflake configuration. After that, you should be able to lowercase column names by running SELECT AS statements. I tested this out by running SELECT hospital as "hospital" FROM emory.public.raw_er, which returned a lowercase hospital column.
@yuyuhan0306 Try adding
{"connect_args": {"session_parameters": {"QUOTED_IDENTIFIERS_IGNORE_CASE": false}}}to the engine_params of the Snowflake configuration. After that, you should be able to lowercase column names by running SELECT AS statements. I tested this out by runningSELECT hospital as "hospital" FROM emory.public.raw_er, which returned a lowercase hospital column.
I added the parameter to the engine_params of the Snowflake configuration, which worked well for a table view. However, when I try to graph a time series - line chart, I still got the {"error": "'__timestamp'"}.
@yuyuhan0306 Which branch are you on? If you are not on master, you will need this pull request: https://github.com/apache/incubator-superset/pull/7147
@yuguang In order to get the changes from the #7147 PR to work with my system, I had to use a newer version of Superset that hasn't officially been released yet. When I tried to upgrade the metadata database to the newer version, it failed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.
Most helpful comment
@yuyuhan0306 Try adding
{"connect_args": {"session_parameters": {"QUOTED_IDENTIFIERS_IGNORE_CASE": false}}}to the engine_params of the Snowflake configuration. After that, you should be able to lowercase column names by running SELECT AS statements. I tested this out by runningSELECT hospital as "hospital" FROM emory.public.raw_er, which returned a lowercase hospital column.