superset icon indicating copy to clipboard operation
superset copied to clipboard

How to make Time Grains show up with Postgres (without modifying the code)?

Open BobSaintClare opened this issue 9 years ago • 2 comments

  • [/ ] 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.18.3 (dev environment)

Context / setup

I'm connecting to a postgres db on aws. My connection string looks something like postgres://ABC:[email protected]:5432/blahblah I can connect alright and explore the associated table.

Expected results

Time Grains show-up when exploring tables.

Actual results

Time Grains don't show-up.

Steps to reproduce

See above

Digging into the code to make it work

In my environment models.core.db_engine_spec (https://github.com/airbnb/superset/blob/master/superset/models/core.py#L651) always returns db_engine_specs.BaseEngineSpec and therefore models.core.grains (https://github.com/airbnb/superset/blob/master/superset/models/core.py#L655) always returns empty. Digging further, it seems that it's because (via https://github.com/airbnb/superset/blob/master/superset/db_engine_specs.py#L913 ), I should somehow have 'postgres' associated with PostgresEngineSpec in my globals. But that doesn't seem to be the case. The workaround is to change https://github.com/airbnb/superset/blob/master/superset/models/core.py#L653 to instead default to PostgresEngineSpec - then everything works beautifully.

Question

Am I missing something in my config or environment or what-not?

Note: there's a related issue (https://github.com/airbnb/superset/issues/1754), but I don't think it's relevant anymore.

Thanks in advance!

BobSaintClare avatar Jun 21 '17 17:06 BobSaintClare

OK. Never mind. :-) My DB URI should start with "postgresql://" and NOT "postgres://". Per the doc (http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#database-urls). Closing this. You guys can probably close https://github.com/airbnb/superset/issues/1754 as well

BobSaintClare avatar Jun 21 '17 19:06 BobSaintClare

I ❤️ when issues close themselves :)

mistercrunch avatar Jun 21 '17 19:06 mistercrunch