You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "ku7mich (via GitHub)" <gi...@apache.org> on 2026/04/13 14:52:07 UTC

[I] SAP HANA calculation view call with PLACEHOLDER parameters is re-cased by Superset 6.0.0 and causes "invalid table name" (HANA error 259) [superset]

ku7mich opened a new issue, #39328:
URL: https://github.com/apache/superset/issues/39328

   ### Bug description
   
   Environment:
   - Superset 6.0.0 (worked in 5.0.0)
   - Python 3.11.14
   - SQLAlchemy: 1.4.54
   - sqlalchemy-hana: 2.8.0
   
   Steps to reproduce:
   1. Open SQL Lab and select SAP HANA connection.
   2. Run the following SQL:
   `SELECT * FROM _sys_bic."zbw.10_001/INVENTORY" 
   (
     'PLACEHOLDER' = ('$$IP_DATE_TO$$', ''),
     'PLACEHOLDER' = ('$$IP_DATE_FROM$$', '')
   )`
   
   Superset returns error: 
   `SAP HANA Error
   hana error: (259, 'invalid table name: Could not find table/view ZBW.10_001/INVENTORY in schema _SYS_BIC: line 6 col 17 (at pos 49)')`
   
   If run the same SQL query without PLACEHOLDER, it's OK:
   `SELECT * FROM _sys_bic."zbw.10_001/INVENTORY"`
   
   If run the same SQL query without PLACEHOLDER, but with "ZBW" in uppercase the error is repeated (even in Superset 5.0.0):
   `SELECT * FROM _sys_bic."ZBW.10_001/INVENTORY"`
   
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   6.0.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] SAP HANA calculation view call with PLACEHOLDER parameters is re-cased by Superset 6.0.0 and causes "invalid table name" (HANA error 259) [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #39328:
URL: https://github.com/apache/superset/issues/39328#issuecomment-4237572338

   <!-- Greeting -->
   Hi @ku7mich! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
   
   <!-- Answer -->
   This is caused by Superset 6.0.0 always parsing and regenerating SQL queries through **sqlglot** before execution [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql_lab.py#L437-L443). SAP HANA is mapped to the PostgreSQL dialect in sqlglot [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py#L81), and when sqlglot regenerates your SQL, it uppercases the quoted identifier `"zbw.10_001/INVENTORY"` → `"ZBW.10_001/INVENTORY"`, which breaks the case-sensitive HANA lookup.
   
   Between Superset 5.0.0 and 6.0.0, sqlglot was upgraded from v27 to v28, which likely changed how the PostgreSQL dialect handles quoted identifiers with special characters like `.` and `/`. This is part of a broader pattern — several databases (PostgreSQL, SQL Server, Oracle, ClickHouse) have reported sqlglot regeneration corrupting queries in 6.0.0.
   
   **Workaround options:**
   
   1. **Create a HANA view** that wraps the calculation view with PLACEHOLDERs, and query that view from Superset instead.
   2. **Downgrade to Superset 5.0.0** if this is a blocker.
   
   **For a proper fix**, this likely needs either:
   
   - A **custom sqlglot dialect for SAP HANA** (similar to what was done for [Pinot](https://github.com/apache/superset/pull/35333)) that preserves identifier casing correctly.
   - Or a change to the HANA dialect mapping in [`superset/sql/parse.py`](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py#L81) to use a dialect that doesn't uppercase quoted identifiers.
   - Or reporting the specific identifier uppercasing behavior to the [sqlglot project](https://github.com/tobymao/sqlglot) as a bug.
   
   You can verify this is the root cause by checking what SQL Superset actually sends to HANA — look at the `executed_sql` field in the query history, or test parsing/regenerating your query directly with sqlglot v28 using the PostgreSQL dialect.
   
   
   <!-- 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=85129849-d354-45f3-b313-1c01efaa2e57&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=85129849-d354-45f3-b313-1c01efaa2e57&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=85129849-d354-45f3-b313-1c01efaa2e57&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=85129849-d354-45f3-b313-1c01efaa2e57&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=85129849-d354-45f3-b313-1c01efaa2e57&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=85129849-d354-45f3-b313-1c01efaa2e57&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=85129849-d354-45f3-b313-1c01efaa2e57&feedback_type=other)</sup>
   [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](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)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20caused%20by%20Superset%206.0.0%20always%20parsing%20and%20regenerating%20SQL%20queries%20through%20%2A%2Asqlglot%2A%2A%20before%20execution%20%5B%5B1%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql_lab.py%23L437-L443%29.%20SAP%20HANA%20is%20mapped%20to%20the%20PostgreSQL%20dialect%20in%20sqlglot%20%5B%5B2%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py%23L81%29%2C%20and%20when%20sqlglot%20regenerates%20your%20SQL%2C%20it%20uppercases%20the%20quoted%20identifier%20%60%22zbw.10_001/INVENTORY%22%60%20%E2%86%92%20%60%22ZBW.10_001/INVENTORY%22%60%2
 C%20which%20breaks%20the%20case-sensitive%20HANA%20lookup.%0A%0ABetween%20Superset%205.0.0%20and%206.0.0%2C%20sqlglot%20was%20upgraded%20from%20v27%20to%20v28%2C%20which%20likely%20changed%20how%20the%20PostgreSQL%20dialect%20handles%20quoted%20identifiers%20with%20special%20characters%20like%20%60.%60%20and%20%60/%60.%20This%20is%20part%20of%20a%20broader%20pattern%20%E2%80%94%20several%20databases%20%28PostgreSQL%2C%20SQL%20Server%2C%20Oracle%2C%20ClickHouse%29%20have%20reported%20sqlglot%20regeneration%20corrupting%20queries%20in%206.0.0.%0A%0A%2A%2AWorkaround%20options%3A%2A%2A%0A%0A1.%20%2A%2ACreate%20a%20HANA%20view%2A%2A%20that%20wraps%20the%20calculation%20view%20with%20PLACEHOLDERs%2C%20and%20query%20that%20view%20from%20Superset%20instead.%0A2.%20%2A%2ADowngrade%20to%20Superset%205.0.0%2A%2A%20if%20this%20is%20a%20blocker.%0A%0A%2A%2AFor%20a%20proper%20fix%2A%2A%2C%20this%20likely%20needs%20either%3A%0A%0A-%20A%20%2A%2Acustom%20sqlglot%20dialect%20for%20SAP%20HANA%2A%2A%20
 %28similar%20to%20what%20was%20done%20for%20%5BPinot%5D%28https%3A//github.com/apache/superset/pull/35333%29%29%20that%20preserves%20identifier%20casing%20correctly.%0A-%20Or%20a%20change%20to%20the%20HANA%20dialect%20mapping%20in%20%5B%60superset/sql/parse.py%60%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/sql/parse.py%23L81%29%20to%20use%20a%20dialect%20that%20doesn%27t%20uppercase%20quoted%20identifiers.%0A-%20Or%20reporting%20the%20specific%20identifier%20uppercasing%20behavior%20to%20the%20%5Bsqlglot%20project%5D%28https%3A//github.com/tobymao/sqlglot%29%20as%20a%20bug.%0A%0AYou%20can%20verify%20this%20is%20the%20root%20cause%20by%20checking%20what%20SQL%20Superset%20actually%20sends%20to%20HANA%20%E2%80%94%20look%20at%20the%20%60executed_sql%60%20field%20in%20the%20query%20history%2C%20or%20test%20parsing/regenerating%20your%20query%20directly%20with%20sqlglot%20v28%20using%20the%20PostgreSQL%20dialect.)&nbsp;[![Join Discord]
 (https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/39328)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] SAP HANA calculation view call with PLACEHOLDER parameters is re-cased by Superset 6.0.0 and causes "invalid table name" (HANA error 259) [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #39328: SAP HANA calculation view call with PLACEHOLDER parameters is re-cased by Superset 6.0.0 and causes "invalid table name" (HANA error 259)
URL: https://github.com/apache/superset/issues/39328


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org