You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "asishPatnaik2000 (via GitHub)" <gi...@apache.org> on 2026/04/13 05:55:00 UTC
[D] Query issue [superset]
GitHub user asishPatnaik2000 created a discussion: Query issue
Divison operation is not working in oracle query after upgradation from superset 4.1,4 to v 6.0.0 what could be the issue?
DB engine Error
Could not convert string '0' to numeric
This may be triggered by:
Issue 1011 - Superset encountered an unexpected error.
Please reach out to the Chart Owner for assistance.
Chart Owner: Admin User
GitHub link: https://github.com/apache/superset/discussions/39309
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Query issue
<!-- Answer -->
You've reached the anonymous usage limit of `10` interactions per month. Your usage will reset on `2026-05-01`. If you'd like to use Dosu before then, please [register](https://app.dosu.dev/login?referrer=from-anonymous-rate-limit) to increase your limit to `100` interactions per month for free.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=too_verbose) | [Hallucination](https://app
.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4&feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=You%27ve%20reached%20the%20anonymous%20usage%20limit%20of%20%6010%60%20interactions%20per%20month.%20Your%20usage%20will%20reset%20on%20%602026-05-01%60.%20If%20you%27d%20like%20to%20use%20Dosu%20before%20then%2C%20please%20%5Bregister%5D%28https%3A//app.dosu.dev/login%3Freferrer%3Dfrom-anonymous-rate-limit%29%20to%20increase%20your%20limit%20to%20%60100%60%20interactions%20per%20month%20for%20free.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/39309)
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16542493
----
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
Re: [D] Query issue [superset]
Posted by "asishPatnaik2000 (via GitHub)" <gi...@apache.org>.
GitHub user asishPatnaik2000 added a comment to the discussion: Query issue
@dosu cant share generated query for company policies I ca give an example:
ROUND(
MAX(CASE WHEN some_type = 'X' THEN TO_NUMBER(some_value) END)
/ NULLIF((SELECT TO_NUMBER(pref_value) FROM some_preferences WHERE pref_key = 'FACTOR'), 0),
2
)
ethe divison works when run directly through sql lab
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16541890
----
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
Re: [D] Query issue [superset]
Posted by "asishPatnaik2000 (via GitHub)" <gi...@apache.org>.
GitHub user asishPatnaik2000 added a comment to the discussion: Query issue
@dosu we already tried this did not work
CAST(
ROUND(
MAX(CASE WHEN some_type = 'X' THEN TO_NUMBER(some_value) END)
/ NULLIF((SELECT TO_NUMBER(pref_value) FROM some_preferences WHERE pref_key = 'FACTOR'), 0),
2
) AS NUMBER
)
and we checked all the data are valid it is working/charts are coming through superset admin but when rendered through iframe user fetting this issue
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16542252
----
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
Re: [D] Query issue [superset]
Posted by "asishPatnaik2000 (via GitHub)" <gi...@apache.org>.
GitHub user asishPatnaik2000 added a comment to the discussion: Query issue
@dosu i am using these proporties
SESSION_REFRESH_EACH_REQUEST = False
SESSION_SERVER_SIDE = True
SESSION_TYPE = "sqlalchemy"
SESSION_PERMANENT = True
SESSION_USE_SIGNER = True
SESSION_SQLALCHEMY_TABLE = "flask_session"
SESSION_COOKIE_NAME = "session"
SESSION_COOKIE_PATH = "/"
replase sqlalchemy in session_type to filesystem for superseet upgrade from 4.1.4 to 6.0.0
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16542490
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] edited a comment on the discussion: Query issue
<!-- Answer -->
Hi @asishPatnaik2000 — I looked into this further. Your original issue ("Could not convert string '0' to numeric" during division operations on Oracle) is separate from the positional `GROUP BY` issue discussed earlier in this thread, so upgrading sqlglot alone wouldn't fix it.
There's no exact match for this error in existing issues, but here are some likely causes and things to check:
1. **Check the generated SQL** — In SQL Lab or the chart's "View Query" option, look at the actual query Superset generates. Oracle handles type coercion differently than other databases, and a division operation where one operand is implicitly treated as a string (e.g., from a `VARCHAR2` column or a calculated field) would cause this error.
2. **Explicit CAST in your metric/column** — If your division involves columns that Oracle might interpret as strings, try wrapping them with `CAST(column_name AS NUMBER)` or `TO_NUMBER(column_name)` in your metric definition.
3. **Type casting changes in recent versions** — Superset has undergone changes to how Oracle type casting works in time grain expressions and the type system [[1]](https://github.com/apache/superset/pull/37702). If your chart uses temporal columns or epoch conversions, these changes could be contributing.
4. **Oracle driver** — Make sure you're using the recommended `oracledb` driver rather than the legacy `cx_Oracle` [[2]](https://github.com/apache/superset/pull/35242), and check your SQLAlchemy version compatibility.
To help narrow this down further, could you share:
- The **full stack trace** from the Superset logs (not just the UI error message)?
- The **generated SQL query** from the chart (via "View Query")?
- Whether the division works fine when run directly in Oracle SQL Developer or similar?
That would help identify whether the issue is in Superset's query generation or in Oracle's handling of the generated SQL.
<!-- 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).*
---
Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-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=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=24f96411-7289-4e15-b76c-62c7ef6a8672) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-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=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16539810
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] edited a comment on the discussion: Query issue
<!-- Answer -->
Thanks for the example and the clarification — that's very helpful. The fact that the division works in SQL Lab but fails in a chart is a strong clue.
**The root cause is likely how Superset wraps chart queries differently from SQL Lab.** SQL Lab executes your SQL directly against the database [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/helpers.py), but when rendering a chart, Superset compiles your metric expression into a SQLAlchemy query object, then wraps it in subqueries for limits, filtering, and post-processing [[2]](https://github.com/apache/superset/issues/38650#issuecomment-4060590098). This wrapping can alter how Oracle interprets type conversions — your `TO_NUMBER()` calls and the division may lose their context when nested inside Superset's generated subquery layers, causing Oracle to treat a numeric result as a string.
Since Oracle's engine spec doesn't define custom type mutators [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/base.py), the error is almost certainly happening during **query generation/transformation**, not result processing.
**Workarounds to try:**
1. **Wrap the entire expression in an explicit CAST** in your metric definition:
```sql
CAST(
ROUND(
MAX(CASE WHEN some_type = 'X' THEN TO_NUMBER(some_value) END)
/ NULLIF((SELECT TO_NUMBER(pref_value) FROM some_preferences WHERE pref_key = 'FACTOR'), 0),
2
) AS NUMBER
)
```
2. **Use a virtual dataset** — create a SQL query in SQL Lab that performs the division, save it as a virtual dataset, and build your chart on that instead. This avoids the metric compilation layer entirely.
3. **Check if the subquery in your metric is the issue** — the `SELECT ... FROM some_preferences` subquery inside the metric might not survive Superset's query wrapping correctly. Try pre-computing the factor value in a virtual dataset or using a JOIN instead of a subquery within the metric.
Could you also share:
- The **Superset server logs** (Python traceback) when the chart fails? That would pinpoint exactly where the type conversion breaks.
- Whether you're using this as a **custom SQL metric** in the chart or as part of a **virtual dataset**?
<!-- 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=89d22005-b739-4c36-a52a-b4b2fbae14d7) [](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/39309#discussioncomment-16541958
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Query issue
<!-- Answer -->
Thanks for the example and the clarification — that's very helpful. The fact that the division works in SQL Lab but fails in a chart is a strong clue.
**The root cause is likely how Superset wraps chart queries differently from SQL Lab.** SQL Lab executes your SQL directly against the database [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/helpers.py), but when rendering a chart, Superset compiles your metric expression into a SQLAlchemy query object, then wraps it in subqueries for limits, filtering, and post-processing [[2]](https://github.com/apache/superset/issues/38650#issuecomment-4060590098). This wrapping can alter how Oracle interprets type conversions — your `TO_NUMBER()` calls and the division may lose their context when nested inside Superset's generated subquery layers, causing Oracle to treat a numeric result as a string.
Since Oracle's engine spec doesn't define custom type mutators [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/base.py), the error is almost certainly happening during **query generation/transformation**, not result processing.
**Workarounds to try:**
1. **Wrap the entire expression in an explicit CAST** in your metric definition:
```sql
CAST(
ROUND(
MAX(CASE WHEN some_type = 'X' THEN TO_NUMBER(some_value) END)
/ NULLIF((SELECT TO_NUMBER(pref_value) FROM some_preferences WHERE pref_key = 'FACTOR'), 0),
2
) AS NUMBER
)
```
2. **Use a virtual dataset** — create a SQL query in SQL Lab that performs the division, save it as a virtual dataset, and build your chart on that instead. This avoids the metric compilation layer entirely.
3. **Check if the subquery in your metric is the issue** — the `SELECT ... FROM some_preferences` subquery inside the metric might not survive Superset's query wrapping correctly. Try pre-computing the factor value in a virtual dataset or using a JOIN instead of a subquery within the metric.
Could you also share:
- The **Superset server logs** (Python traceback) when the chart fails? That would pinpoint exactly where the type conversion breaks.
- Whether you're using this as a **custom SQL metric** in the chart or as part of a **virtual dataset**?
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=too_verbose) | [Hallucination](https://app
.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=89d22005-b739-4c36-a52a-b4b2fbae14d7&feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=Thanks%20for%20the%20example%20and%20the%20clarification%20%E2%80%94%20that%27s%20very%20helpful.%20The%20fact%20that%20the%20division%20works%20in%20SQL%20Lab%20but%20fails%20in%20a%20chart%20is%20a%20strong%20clue.%0A%0A%2A%2AThe%20root%20cause%20is%20likely%20how%20Superset%20wraps%20chart%20queries%20differently%20from%20SQL%20Lab.%2A%2A%20SQL%20Lab%20executes%20your%20SQL%20directly%20against%20the%20database%20%5B%5B1%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/models/helpers.py%29%2C%20but%20when%20rendering%20a%20chart%2C%20Superset%20compiles%20your%20metric%20expression%20into%20a%20SQLAlchemy%20query%20object%2
C%20then%20wraps%20it%20in%20subqueries%20for%20limits%2C%20filtering%2C%20and%20post-processing%20%5B%5B2%5D%5D%28https%3A//github.com/apache/superset/issues/38650%23issuecomment-4060590098%29.%20This%20wrapping%20can%20alter%20how%20Oracle%20interprets%20type%20conversions%20%E2%80%94%20your%20%60TO_NUMBER%28%29%60%20calls%20and%20the%20division%20may%20lose%20their%20context%20when%20nested%20inside%20Superset%27s%20generated%20subquery%20layers%2C%20causing%20Oracle%20to%20treat%20a%20numeric%20result%20as%20a%20string.%0A%0ASince%20Oracle%27s%20engine%20spec%20doesn%27t%20define%20custom%20type%20mutators%20%5B%5B3%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/base.py%29%2C%20the%20error%20is%20almost%20certainly%20happening%20during%20%2A%2Aquery%20generation/transformation%2A%2A%2C%20not%20result%20processing.%0A%0A%2A%2AWorkarounds%20to%20try%3A%2A%2A%0A%0A1.%20%2A%2AWrap%20the%20entire%20expression%20in%2
0an%20explicit%20CAST%2A%2A%20in%20your%20metric%20definition%3A%0A%0A%20%20%20%60%60%60sql%0A%20%20%20CAST%28%0A%20%20%20%20%20ROUND%28%0A%20%20%20%20%20%20%20MAX%28CASE%20WHEN%20some_type%20%3D%20%27X%27%20THEN%20TO_NUMBER%28some_value%29%20END%29%0A%20%20%20%20%20%20%20%20%20/%20NULLIF%28%28SELECT%20TO_NUMBER%28pref_value%29%20FROM%20some_preferences%20WHERE%20pref_key%20%3D%20%27FACTOR%27%29%2C%200%29%2C%0A%20%20%20%20%20%20%202%0A%20%20%20%20%20%29%20AS%20NUMBER%0A%20%20%20%29%0A%20%20%20%60%60%60%0A%0A2.%20%2A%2AUse%20a%20virtual%20dataset%2A%2A%20%E2%80%94%20create%20a%20SQL%20query%20in%20SQL%20Lab%20that%20performs%20the%20division%2C%20save%20it%20as%20a%20virtual%20dataset%2C%20and%20build%20your%20chart%20on%20that%20instead.%20This%20avoids%20the%20metric%20compilation%20layer%20entirely.%0A%0A3.%20%2A%2ACheck%20if%20the%20subquery%20in%20your%20metric%20is%20the%20issue%2A%2A%20%E2%80%94%20the%20%60SELECT%20...%20FROM%20some_preferences%60%20subquery%20inside%20the%20m
etric%20might%20not%20survive%20Superset%27s%20query%20wrapping%20correctly.%20Try%20pre-computing%20the%20factor%20value%20in%20a%20virtual%20dataset%20or%20using%20a%20JOIN%20instead%20of%20a%20subquery%20within%20the%20metric.%0A%0ACould%20you%20also%20share%3A%0A%0A-%20The%20%2A%2ASuperset%20server%20logs%2A%2A%20%28Python%20traceback%29%20when%20the%20chart%20fails%3F%20That%20would%20pinpoint%20exactly%20where%20the%20type%20conversion%20breaks.%0A-%20Whether%20you%27re%20using%20this%20as%20a%20%2A%2Acustom%20SQL%20metric%2A%2A%20in%20the%20chart%20or%20as%20part%20of%20a%20%2A%2Avirtual%20dataset%2A%2A%3F) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20
issue!&url=https%3A//github.com/apache/superset/discussions/39309)
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16541958
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Query issue
<!-- Answer -->
This is a really important detail — **it works as admin in Superset but fails when rendered via iframe**. That changes the diagnosis significantly. This is likely not a pure Oracle division issue but rather a problem with how Superset generates queries in **embedded/guest token mode**.
Here are the most probable causes:
**1. Double RLS application bug (Superset 6.0.0 regression)**
If you're using Row Level Security rules in your guest token, there's a [known regression in 6.0.0](https://github.com/apache/superset/issues/37359) where RLS filters get applied **twice** — once wrapping the query in a subquery and again as a WHERE clause on the outer query. This double-wrapping can break type context for your division expression, causing Oracle to misinterpret numeric values as strings. This was introduced by PR #36061.
**Workaround**: Use physical datasets instead of virtual datasets, or check if [PR #37395](https://github.com/apache/superset/pull/37395) has been backported to your version.
**2. Guest token RLS configuration issues**
Guest token RLS rules are only applied when [[1]](https://github.com/apache/superset/discussions/36494#discussioncomment-15222256):
- The `EMBEDDED_SUPERSET` feature flag is enabled
- The `user.username` field in the guest token is **non-empty**
If the RLS rules aren't applying correctly, the query context can differ from what admin sees, potentially triggering different query paths.
**3. Missing query_context on charts**
Charts that lack a properly populated `query_context` field can fail specifically in embedded mode with guest tokens while working fine for admin users [[2]](https://github.com/apache/superset/issues/32753#issuecomment-2736609569). Try opening and **re-saving each affected chart** in the Superset UI to regenerate the query context.
**To narrow this down, could you check:**
- Are you using **RLS rules** in your guest token?
- Is this a **virtual dataset** (SQL query-based) or a **physical dataset** (direct table)?
- What does the **Superset server log** show when the iframe chart fails? The full Python traceback would pinpoint whether it's the double-RLS bug or something else.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=too_verbose) | [Hallucination](https://app
.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=665de11c-2dea-4e92-a830-f0ebd83b4b3d&feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=This%20is%20a%20really%20important%20detail%20%E2%80%94%20%2A%2Ait%20works%20as%20admin%20in%20Superset%20but%20fails%20when%20rendered%20via%20iframe%2A%2A.%20That%20changes%20the%20diagnosis%20significantly.%20This%20is%20likely%20not%20a%20pure%20Oracle%20division%20issue%20but%20rather%20a%20problem%20with%20how%20Superset%20generates%20queries%20in%20%2A%2Aembedded/guest%20token%20mode%2A%2A.%0A%0AHere%20are%20the%20most%20probable%20causes%3A%0A%0A%2A%2A1.%20Double%20RLS%20application%20bug%20%28Superset%206.0.0%20regression%29%2A%2A%0AIf%20you%27re%20using%20Row%20Level%20Security%20rules%20in%20your%20guest%20token%2C%20there%27s%20a%20%5Bknown%20regression%20in%206.0.
0%5D%28https%3A//github.com/apache/superset/issues/37359%29%20where%20RLS%20filters%20get%20applied%20%2A%2Atwice%2A%2A%20%E2%80%94%20once%20wrapping%20the%20query%20in%20a%20subquery%20and%20again%20as%20a%20WHERE%20clause%20on%20the%20outer%20query.%20This%20double-wrapping%20can%20break%20type%20context%20for%20your%20division%20expression%2C%20causing%20Oracle%20to%20misinterpret%20numeric%20values%20as%20strings.%20This%20was%20introduced%20by%20PR%20%2336061.%0A%0A%2A%2AWorkaround%2A%2A%3A%20Use%20physical%20datasets%20instead%20of%20virtual%20datasets%2C%20or%20check%20if%20%5BPR%20%2337395%5D%28https%3A//github.com/apache/superset/pull/37395%29%20has%20been%20backported%20to%20your%20version.%0A%0A%2A%2A2.%20Guest%20token%20RLS%20configuration%20issues%2A%2A%0AGuest%20token%20RLS%20rules%20are%20only%20applied%20when%20%5B%5B1%5D%5D%28https%3A//github.com/apache/superset/discussions/36494%23discussioncomment-15222256%29%3A%0A%0A-%20The%20%60EMBEDDED_SUPERSET%60%20feature%20f
lag%20is%20enabled%0A-%20The%20%60user.username%60%20field%20in%20the%20guest%20token%20is%20%2A%2Anon-empty%2A%2A%0A%0AIf%20the%20RLS%20rules%20aren%27t%20applying%20correctly%2C%20the%20query%20context%20can%20differ%20from%20what%20admin%20sees%2C%20potentially%20triggering%20different%20query%20paths.%0A%0A%2A%2A3.%20Missing%20query_context%20on%20charts%2A%2A%0ACharts%20that%20lack%20a%20properly%20populated%20%60query_context%60%20field%20can%20fail%20specifically%20in%20embedded%20mode%20with%20guest%20tokens%20while%20working%20fine%20for%20admin%20users%20%5B%5B2%5D%5D%28https%3A//github.com/apache/superset/issues/32753%23issuecomment-2736609569%29.%20Try%20opening%20and%20%2A%2Are-saving%20each%20affected%20chart%2A%2A%20in%20the%20Superset%20UI%20to%20regenerate%20the%20query%20context.%0A%0A%2A%2ATo%20narrow%20this%20down%2C%20could%20you%20check%3A%2A%2A%0A%0A-%20Are%20you%20using%20%2A%2ARLS%20rules%2A%2A%20in%20your%20guest%20token%3F%0A-%20Is%20this%20a%20%2A%2Avirtu
al%20dataset%2A%2A%20%28SQL%20query-based%29%20or%20a%20%2A%2Aphysical%20dataset%2A%2A%20%28direct%20table%29%3F%0A-%20What%20does%20the%20%2A%2ASuperset%20server%20log%2A%2A%20show%20when%20the%20iframe%20chart%20fails%3F%20The%20full%20Python%20traceback%20would%20pinpoint%20whether%20it%27s%20the%20double-RLS%20bug%20or%20something%20else.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/39309)
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16542374
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] edited a comment on the discussion: Query issue
<!-- Answer -->
You've reached the anonymous usage limit of `10` interactions per month. Your usage will reset on `2026-05-01`. If you'd like to use Dosu before then, please [register](https://app.dosu.dev/login?referrer=from-anonymous-rate-limit) to increase your limit to `100` interactions per month for free.
<!-- 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).*
---
Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-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=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=2f994f5f-bef3-4b8e-abd7-7e4af2bcf5b4) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-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=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16542493
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] edited a comment on the discussion: Query issue
<!-- Answer -->
This is a really important detail — **it works as admin in Superset but fails when rendered via iframe**. That changes the diagnosis significantly. This is likely not a pure Oracle division issue but rather a problem with how Superset generates queries in **embedded/guest token mode**.
Here are the most probable causes:
**1. Double RLS application bug (Superset 6.0.0 regression)**
If you're using Row Level Security rules in your guest token, there's a [known regression in 6.0.0](https://github.com/apache/superset/issues/37359) where RLS filters get applied **twice** — once wrapping the query in a subquery and again as a WHERE clause on the outer query. This double-wrapping can break type context for your division expression, causing Oracle to misinterpret numeric values as strings. This was introduced by PR #36061.
**Workaround**: Use physical datasets instead of virtual datasets, or check if [PR #37395](https://github.com/apache/superset/pull/37395) has been backported to your version.
**2. Guest token RLS configuration issues**
Guest token RLS rules are only applied when [[1]](https://github.com/apache/superset/discussions/36494#discussioncomment-15222256):
- The `EMBEDDED_SUPERSET` feature flag is enabled
- The `user.username` field in the guest token is **non-empty**
If the RLS rules aren't applying correctly, the query context can differ from what admin sees, potentially triggering different query paths.
**3. Missing query_context on charts**
Charts that lack a properly populated `query_context` field can fail specifically in embedded mode with guest tokens while working fine for admin users [[2]](https://github.com/apache/superset/issues/32753#issuecomment-2736609569). Try opening and **re-saving each affected chart** in the Superset UI to regenerate the query context.
**To narrow this down, could you check:**
- Are you using **RLS rules** in your guest token?
- Is this a **virtual dataset** (SQL query-based) or a **physical dataset** (direct table)?
- What does the **Superset server log** show when the iframe chart fails? The full Python traceback would pinpoint whether it's the double-RLS bug or something else.
<!-- 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=665de11c-2dea-4e92-a830-f0ebd83b4b3d) [](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/39309#discussioncomment-16542374
----
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
Re: [D] Query issue [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Query issue
<!-- Answer -->
Hi @asishPatnaik2000 — I looked into this further. Your original issue ("Could not convert string '0' to numeric" during division operations on Oracle) is separate from the positional `GROUP BY` issue discussed earlier in this thread, so upgrading sqlglot alone wouldn't fix it.
There's no exact match for this error in existing issues, but here are some likely causes and things to check:
1. **Check the generated SQL** — In SQL Lab or the chart's "View Query" option, look at the actual query Superset generates. Oracle handles type coercion differently than other databases, and a division operation where one operand is implicitly treated as a string (e.g., from a `VARCHAR2` column or a calculated field) would cause this error.
2. **Explicit CAST in your metric/column** — If your division involves columns that Oracle might interpret as strings, try wrapping them with `CAST(column_name AS NUMBER)` or `TO_NUMBER(column_name)` in your metric definition.
3. **Type casting changes in recent versions** — Superset has undergone changes to how Oracle type casting works in time grain expressions and the type system [[1]](https://github.com/apache/superset/pull/37702). If your chart uses temporal columns or epoch conversions, these changes could be contributing.
4. **Oracle driver** — Make sure you're using the recommended `oracledb` driver rather than the legacy `cx_Oracle` [[2]](https://github.com/apache/superset/pull/35242), and check your SQLAlchemy version compatibility.
To help narrow this down further, could you share:
- The **full stack trace** from the Superset logs (not just the UI error message)?
- The **generated SQL query** from the chart (via "View Query")?
- Whether the division works fine when run directly in Oracle SQL Developer or similar?
That would help identify whether the issue is in Superset's query generation or in Oracle's handling of the generated SQL.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=too_verbose) | [Hallucination](https://app
.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other#message_id=24f96411-7289-4e15-b76c-62c7ef6a8672&feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=Hi%20%40asishPatnaik2000%20%E2%80%94%20I%20looked%20into%20this%20further.%20Your%20original%20issue%20%28%22Could%20not%20convert%20string%20%270%27%20to%20numeric%22%20during%20division%20operations%20on%20Oracle%29%20is%20separate%20from%20the%20positional%20%60GROUP%20BY%60%20issue%20discussed%20earlier%20in%20this%20thread%2C%20so%20upgrading%20sqlglot%20alone%20wouldn%27t%20fix%20it.%0A%0AThere%27s%20no%20exact%20match%20for%20this%20error%20in%20existing%20issues%2C%20but%20here%20are%20some%20likely%20causes%20and%20things%20to%20check%3A%0A%0A1.%20%2A%2ACheck%20the%20generated%20SQL%2A%2A%20%E2%80%94%20In%20SQL%20Lab%20or%20the%20chart%27s%20%22View%20Query%22%20optio
n%2C%20look%20at%20the%20actual%20query%20Superset%20generates.%20Oracle%20handles%20type%20coercion%20differently%20than%20other%20databases%2C%20and%20a%20division%20operation%20where%20one%20operand%20is%20implicitly%20treated%20as%20a%20string%20%28e.g.%2C%20from%20a%20%60VARCHAR2%60%20column%20or%20a%20calculated%20field%29%20would%20cause%20this%20error.%0A%0A2.%20%2A%2AExplicit%20CAST%20in%20your%20metric/column%2A%2A%20%E2%80%94%20If%20your%20division%20involves%20columns%20that%20Oracle%20might%20interpret%20as%20strings%2C%20try%20wrapping%20them%20with%20%60CAST%28column_name%20AS%20NUMBER%29%60%20or%20%60TO_NUMBER%28column_name%29%60%20in%20your%20metric%20definition.%0A%0A3.%20%2A%2AType%20casting%20changes%20in%20recent%20versions%2A%2A%20%E2%80%94%20Superset%20has%20undergone%20changes%20to%20how%20Oracle%20type%20casting%20works%20in%20time%20grain%20expressions%20and%20the%20type%20system%20%5B%5B1%5D%5D%28https%3A//github.com/apache/superset/pull/37702%29.%20If%20y
our%20chart%20uses%20temporal%20columns%20or%20epoch%20conversions%2C%20these%20changes%20could%20be%20contributing.%0A%0A4.%20%2A%2AOracle%20driver%2A%2A%20%E2%80%94%20Make%20sure%20you%27re%20using%20the%20recommended%20%60oracledb%60%20driver%20rather%20than%20the%20legacy%20%60cx_Oracle%60%20%5B%5B2%5D%5D%28https%3A//github.com/apache/superset/pull/35242%29%2C%20and%20check%20your%20SQLAlchemy%20version%20compatibility.%0A%0ATo%20help%20narrow%20this%20down%20further%2C%20could%20you%20share%3A%0A%0A-%20The%20%2A%2Afull%20stack%20trace%2A%2A%20from%20the%20Superset%20logs%20%28not%20just%20the%20UI%20error%20message%29%3F%0A-%20The%20%2A%2Agenerated%20SQL%20query%2A%2A%20from%20the%20chart%20%28via%20%22View%20Query%22%29%3F%0A-%20Whether%20the%20division%20works%20fine%20when%20run%20directly%20in%20Oracle%20SQL%20Developer%20or%20similar%3F%0A%0AThat%20would%20help%20identify%20whether%20the%20issue%20is%20in%20Superset%27s%20query%20generation%20or%20in%20Oracle%27s%20handlin
g%20of%20the%20generated%20SQL.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/39309)
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16539810
----
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
Re: [D] Query issue [superset]
Posted by "asishPatnaik2000 (via GitHub)" <gi...@apache.org>.
GitHub user asishPatnaik2000 added a comment to the discussion: Query issue
@dosu any update on this?
GitHub link: https://github.com/apache/superset/discussions/39309#discussioncomment-16539773
----
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