dosubot[bot] commented on issue #37626: URL: https://github.com/apache/superset/issues/37626#issuecomment-3839742872
<!-- Answer --> There isn't a known bug in Superset 4.1.1 or master where whitespace inside string literals in custom SQL metrics is removed after saving. The backend code for metrics stores and retrieves SQL expressions verbatim—there's no logic in the API, DAO, or ORM layers that strips or modifies whitespace within string literals, and the only transformations applied are optional Jinja template rendering and SQLAlchemy literal handling, neither of which would remove spaces inside quotes ([reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/connectors/sqla/models.py#L639-L1520), [reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/datasets/api.py#L94-L1221), [reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/daos/dataset.py#L280-L325)). Since this isn't expected behavior, it may be caused by a frontend formatting issue, a browser extension, or an undiscovered bug. If you can, try to capture a minimal reproducible example, check if the issue happens in a different browser or incognito mode, and see if the whitespace is missing in the network payload or only in the UI. If you can share HAR files, network requests, or console logs from the moment the whitespace is removed, that would help narrow down the cause. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2eea3265-1182-42ee-94d1-fad28138f728?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=There%20isn%27t%20a%20known%20bug%20in%20Superset%204.1.1%20or%20master%20where%20whitespace%20inside%20string%20literals%20in%20custom%20SQL%20metrics%20is%20removed%20after%20saving.%20The%20backend%20code%20for%20metrics%20stores%20and%20retrieves%20SQL%20expressions%20verbatim%E2%80%94there%27s%20no%20logic%20in%20the%20API%2C%20DAO%2C%20or%20ORM%20layers%20that%20strips%20or%20modifies%20whitespace%20within%20string%20literals%2C%20and%20the%20only%20transformations%20applied%20are%20optional%20Jinja%20template%20rendering%20and%20SQLAlchemy%20literal%20handling%2C%20neither%20of%20which%20would%20remove%20spaces%20inside%20quotes%C2%A0%28%5Breference%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/super set/connectors/sqla/models.py%23L639-L1520%29%2C%20%5Breference%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/datasets/api.py%23L94-L1221%29%2C%20%5Breference%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/daos/dataset.py%23L280-L325%29%29.%0A%0ASince%20this%20isn%27t%20expected%20behavior%2C%20it%20may%20be%20caused%20by%20a%20frontend%20formatting%20issue%2C%20a%20browser%20extension%2C%20or%20an%20undiscovered%20bug.%20If%20you%20can%2C%20try%20to%20capture%20a%20minimal%20reproducible%20example%2C%20check%20if%20the%20issue%20happens%20in%20a%20different%20browser%20or%20incognito%20mode%2C%20and%20see%20if%20the%20whitespace%20is%20missing%20in%20the%20network%20payload%20or%20only%20in%20the%20UI.%20If%20you%20can%20share%20HAR%20files%2C%20network%20requests%2C%20or%20console%20logs%20from%20the%20moment%20the%20whitespace%20is%20removed%2C%20that%20would%20help%20narrow%20dow n%20the%20cause.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37626) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
