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.

Can't select wb_health_population columns using Postgres

See original GitHub issue
  • I have checked the superset logs for python stacktraces and included it here as text if 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.26.0 - following docker-compose instructions

Expected results

Be able to run World Bank dashboard.

Actual results

I’m not able to run any query that state particular wb_health_population column as in Postgres columns created with " " should be referenced this way as well. The exact same problem as here: https://stackoverflow.com/questions/24253814/cant-select-an-existing-column-in-postgresql

2018-09-29 14:00:38,127:INFO:root:SELECT SP_POP_TOTL
FROM wb_health_population
LIMIT 1
2018-09-29 14:00:38,128:ERROR:root:column "sp_pop_totl" does not exist
LINE 1: SELECT SP_POP_TOTL
               ^
Traceback (most recent call last):
  File "/home/work/incubator-superset/superset/sql_lab.py", line 185, in execute_sql
    db_engine_spec.execute(cursor, query.executed_sql, async_=True)
  File "/home/work/incubator-superset/superset/db_engine_specs.py", line 376, in execute
    cursor.execute(query)
psycopg2.ProgrammingError: column "sp_pop_totl" does not exist
LINE 1: SELECT SP_POP_TOTL

Steps to reproduce

Follow docker-compose instructions and try to render WB dashboard.

I hope that it’s not because of the fact I’m still using 0.26. Either way I would be very happy to help with improving test data set generation or with Docker images maintenance.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
trrahulcommented, Sep 30, 2018

Changing the column name to include double quotes works. SELECT country_name AS country_name, SUM(SP_POP_TOTL) AS “sum__SP_POP_TOTL” FROM wb_health_population WHERE year >= ‘2014-01-01 00:00:00’ AND year <= ‘2014-01-02 00:00:00’ GROUP BY country_name ORDER BY “sum__SP_POP_TOTL” DESC LIMIT 50000

to

SELECT country_name AS country_name, SUM(“SP_POP_TOTL”) AS “sum__SP_POP_TOTL” FROM wb_health_population WHERE year >= ‘2014-01-01 00:00:00’ AND year <= ‘2014-01-02 00:00:00’ GROUP BY country_name ORDER BY “sum__SP_POP_TOTL” DESC LIMIT 50000

1reaction
andy-clapsoncommented, Nov 10, 2018

This is a Postgres-specific issue related to column names - Postgres converts all column names to lower case unless they are quoted. So, expected behaviour, but something we can account for. Nope, looks a bit more complicated, and may have to do ‘MetricsControl’. I’m working on a PR for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot select columns by their names in PostgreSQL [duplicate]
I downloaded a PostreSQL file that creates and populates the Chinoook database (a relatively well known database used for testing).
Read more >
Documentation: 15: SELECT - PostgreSQL
You must have SELECT privilege on each column used in a SELECT command. ... In this case the new window cannot specify its...
Read more >
Documentation: 15: 2.5. Querying a Table - PostgreSQL
An SQL SELECT statement is used to do this. The statement is divided ... You can write expressions, not just simple column references,...
Read more >
7.8. WITH Queries (Common Table Expressions) - PostgreSQL
We add two columns is_cycle and path to the loop-prone query: WITH RECURSIVE search_graph(id, link, data, depth, is_cycle, path) AS ( SELECT g.id,...
Read more >
Documentation: 15: UPDATE - PostgreSQL
A SELECT sub-query that produces as many output columns as are listed in the parenthesized column list preceding it. The sub-query must yield...
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