question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Charts built off Snowflake only support uppercase metric labels

See original GitHub issue

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Superset version

0.31.1

Expected results

Chart should render without error when metric is given a non-uppercase label.

Actual results

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'

Steps to reproduce

  1. Create a chart (I’ve reproduced this error with bar chart and line chart).
  2. Add a metric to the chart under Query > Metrics in the chart UI.
  3. Click on the created metric; this will open a new box, and at the top is a place to write a custom label for the metric. Provide the metric a non-uppercase label, e.g. my label.
  4. Run the query.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
yuguangcommented, Apr 29, 2019

@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.

1reaction
yuguangcommented, May 2, 2019

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Charts built off Snowflake only support uppercase metric labels
Chart fails to render when metric is given a non-uppercase label. Stacktrace is as follows: Traceback (most recent call last): File "/home/ ...
Read more >
Using Worksheets for Queries / DML / DDL
Snowflake displays the worksheets that were open when you logged out. Note that resized/collapsed panes, width changes to the result/data preview columns, and ......
Read more >
Snowflake Setup Guide - link - Fivetran
Connect data sources to Snowflake in minutes using Fivetran. Explore documentation and start syncing your applications, databases, events, files, and more.
Read more >
Looker functions and operators | Google Cloud
These functions are supported only for table calculations (including table calculations used in the expression parameter of a data test). This page is...
Read more >
All Functions (Alphabetical) - Tableau Help
An aggregate calculation that combines the values in the argument field. Null values are ignored. Note: The COLLECT function can only be used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found