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 make a timeserie if date is TIMESTAMP WITHOUT TIME ZONE (postgres)

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 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.28 RC6 from 2018-09-12

Expected results

A timeseris graph is displayed

Actual results

  • Unexepeted Error is shown in the UI
  • Inspecting the asnwer from the corresponding https request, it shows a stacktrace finishing with : File "/home/work/incubator-superset/superset/utils.py", line 366, in datetime_to_epoch return (dttm - epoch_with_tz).total_seconds() * 1000 File "pandas/_libs/tslibs/timestamps.pyx", line 320, in pandas._libs.tslibs.timestamps._Timestamp.__sub__ TypeError: Timestamp subtraction must have the same timezones or no timezones

Steps to reproduce

  • Create source from a table having a date column of type TIMESTAMP WITHOUT TIME ZONE (postgres 9.3)
  • Try creating a timeseries graph using it

Workaround

  • According to my colleagues (I could not test), the same database allowed making TS graphs with a version of superset he installed a month ago from an “image for easyer installation he found on github”
  • Adding a record having value my_date WITH TIME ZONE 'MST', typed TIMESTAMP and using it as the time for the graph worked

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
apimasterycommented, Nov 6, 2018

Here is how I fixed this when running a clone of the repo’s master branch from 2018-11-01 and the Docker install (after few “adjustments” to make it work). I hope this will help others until it is permanently fixed…

For the “World’s Bank Data” dashboard:

  • Select Sources --> Tables from the top-level menu.
  • Click on the “Edit” icon for the wb_health_population table.
  • Click on the “List Columns” tab.
  • Scroll down to the “year” column.
  • Click on the “Edit” icon for the “year” column.
  • In the “Expression” box, enter “year ::timestamptz” (without the double quotes).
  • Click on the “Save” button.
  • Access/Refresh the dashboard.

I had another issue with the “World’s Bank Data” dashboard - some charts were erroring out with ‘column “xxxx” does not exist’. For example, ‘column “sp_pop_totl” does not exist’. To fix:

  • Select Sources --> Tables from the top-level menu.
  • Click on the “Edit” icon for the wb_health_population table.
  • Click on the List Metrics tab.
  • Find the metric for the offending column. For example, sum__SP_POP_TOTL and click on its “Edit” icon.
  • Surround the column name in the “SQL Expression” field with double quotes. For example, change it from SUM(SP_POP_TOTL) to SUM(“SP_POP_TOTL”)

HTH

5reactions
kingo55commented, Oct 30, 2018

@davidgreenshtein - Sometimes you can work around it by creating a new calculated column and coercing to ::timestamptz

It doesn’t work if you just update the database expression though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't make a timeserie if date is TIMESTAMP WITHOUT ...
Create source from a table having a date column of type TIMESTAMP WITHOUT TIME ZONE (postgres 9.3); Try creating a timeseries graph using...
Read more >
What is a valid use case for using TIMESTAMP WITHOUT ...
It's valid to use timestamp and date for any timestamps and dates which are always in the same timezone, or are being stored...
Read more >
Ignoring time zones altogether in Rails and PostgreSQL
I'm currently using 'timestamp without time zone' but when I retrieve the records, rails (?) converts them to the time zone in the...
Read more >
BUG #15527: Issue converting from local date/time to ' ...
We have an application that is storing time series data in ... 'timestamp with time zone' field. ... I'm wondering if this is...
Read more >
Using Postgres as a time series database
In practice when logging time series data, this is not usually a problem since each measurement device can neatly have its own column....
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