Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function date_trunc(unknown, text) does not exist in Line Chart #8910

Open
klazaj opened this issue Jan 2, 2020 · 5 comments
Open

function date_trunc(unknown, text) does not exist in Line Chart #8910

klazaj opened this issue Jan 2, 2020 · 5 comments
Labels

Comments

@klazaj
Copy link

@klazaj klazaj commented Jan 2, 2020

When trying to create a line chart from a datasource I have uploaded (through CSV upload), I get the following error:

function date_trunc(unknown, text) does not exist LINE 2: DATE_TRUNC('day', created) AS __timestamp, ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.

Column details:
image

The column details and date format are exactly the same as the 'examples.birthnames' provided by Superset. Why do I get an error? Database is Superset's own Postgres

@issue-label-bot issue-label-bot bot added the #bug label Jan 2, 2020
@issue-label-bot

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Jan 2, 2020

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.80. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@klazaj

This comment has been minimized.

Copy link
Author

@klazaj klazaj commented Jan 3, 2020

If I put the date column in Parse Dates field when importing the CSV, I do not get this error anymore.
Maybe someone can elaborate why changing the column type manually results in an error?

@villebro

This comment has been minimized.

Copy link
Contributor

@villebro villebro commented Jan 3, 2020

@klazaj what database engine are you on?

@rumbin

This comment has been minimized.

Copy link
Contributor

@rumbin rumbin commented Jan 3, 2020

In my understanding Postgres tries to apply the date_trunc() function on a column with data type 'text', which will obviously fail.

If you check the column dtype of this table, e.g., using any DB explorer like pgadmin or DBeaver you will most likely see that it is of type text and not timestamp.

By adding the column to the Parse Dates list, you tell Superset (in fact, supposedly, Pandas' read_csv() function) to try to interpret the column as timestamp, which then leads to setting the correct dtype in the DB table.

@rumbin

This comment has been minimized.

Copy link
Contributor

@rumbin rumbin commented Jan 3, 2020

In my eyes this probably is the expected behaviour, at least from Superset's point of view.

The user might expect something different, perhaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.