You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dosubot[bot] (via GitHub)" <gi...@apache.org> on 2026/05/02 02:50:21 UTC
Re: [D] datetime data type shown as string [superset]
GitHub user dosubot[bot] edited a comment on the discussion: datetime data type shown as string
<!-- Answer -->
This is a recognized pattern after upgrading Superset across major versions with Oracle. Here's what's likely happening and how to fix it:
**Why one column shows "?" and the other doesn't:** Superset determines if a column is temporal by regex-matching the database type string (e.g., `^date`, `^timestamp`) reported by the driver [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/base.py#L307-L331). If the driver returns a NULL, empty, or non-standard type string for a column, it won't match any pattern and will show as unknown (?). The Oracle engine spec has no custom type mappings — it relies entirely on these default patterns [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/oracle.py#L26-L81). So if one column's type string is being reported differently by the driver after upgrade, that column will lose its temporal status while others continue to work.
**What changed between 4.x and 6.0.0:**
1. **Driver migration** from `cx_Oracle` (unmaintained since 2021) to `oracledb` — this may have changed how native type strings are reported in cursor descriptions [[3]](https://github.com/apache/superset/pull/35242)
2. **Stricter temporal detection** — several PRs (e.g., #36150, #36309) tightened how temporal columns are identified, replacing heuristic fallbacks with actual type checking [[4]](https://github.com/apache/superset/pull/37433) [[5]](https://github.com/apache/superset/pull/36309)
3. **Oracle DATE vs TIMESTAMP mismatch** — Oracle's `TRUNC()` returns DATE while Superset expects TIMESTAMP for time-grain operations, which can cause SQL errors in time filters [[6]](https://github.com/apache/superset/pull/37702)
**Recommended fix — try these in order:**
1. **Sync columns from source**: Go to Dataset Editor → Columns tab → click "Sync Columns from Source." This refreshes the column metadata from the database and should re-detect types correctly. ⚠️ Note this is a destructive operation — if the query fails (e.g., due to Jinja templates), it can remove all columns [[7]](https://github.com/apache/superset/issues/25839#issuecomment-3643862476).
2. **Manually set the temporal flag**: If syncing doesn't fix it, manually toggle `is_dttm = True` for the affected column in the dataset editor. The explicit flag overrides automatic detection [[8]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/connectors/sqla/models.py#L912-L921).
3. **CAST workaround**: If time filtering still generates bad SQL, create a virtual column with `CAST(your_column AS TIMESTAMP)` and mark it as temporal. This is the established workaround for Oracle DATE columns that Superset misinterprets [[9]](https://github.com/apache/superset/issues/37608).
4. **Enable datetime format detection**: Set `DATASET_AUTO_DETECT_DATETIME_FORMATS = True` in your Superset config for better datetime handling [[10]](https://github.com/apache/superset/pull/36150).
Notably, [another user in this same thread](https://github.com/apache/superset/issues/34784#issuecomment-4221948838) reported a similar issue with Superset 6.0.0 not recognizing datetime column data types, so you're not alone here. Starting with "Sync Columns from Source" is the quickest path to a fix.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=b0cba27d-6f83-4965-870f-9ce8fbf78c01) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/39271#discussioncomment-16513409
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org