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

[I] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

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

   ### Bug description
   
   Step to Reproduce.
   1. Enable Async Query
   2. Define Metrics in chart with custom sql that have \r\n(new line) or jinja template superset did order by <Metrics>
   3. Open Dashboard with that chart
   
   Investigation
   1. Cache key on writing and reading got different..
   2. Check value before hashing to cache key found that **orderby.sqlExpression** got different.
   2.1 case \r\n writing cache still have \r\n but reading cache got change to \n so generate different cache key.
   2.2 case jinja template  
         writing cache 
         > 'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0] %}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS percentile={{ no_of_mrs }}/100)"}
   
         reading cache
        > 'sqlExpression': '\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS percentile=75/100)'}
   
        so it generate different cache key.
   
   Workaround 
   manual add sort by count(*) or 1
   not sure why it alway added order by <Metrics> as default.
   
   ### Screenshots/recordings
   
   <img width="2685" height="1288" alt="Image" src="https://github.com/user-attachments/assets/33e5d4c4-e59d-493d-a565-cbf7d7ca8ccf" />
   
   ### Superset version
   
   5.0.0
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [ ] 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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

Posted by "SkinnyPigeon (via GitHub)" <gi...@apache.org>.
SkinnyPigeon commented on issue #37114:
URL: https://github.com/apache/superset/issues/37114#issuecomment-4533272209

   Hey @villebro, we also have this across multiple charts. Disabling `GLOBAL_ASYNC_QUERIES` solves this. However, it would be nice to have that enabled 😄 


-- 
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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

Posted by "Ujjwaljain16 (via GitHub)" <gi...@apache.org>.
Ujjwaljain16 commented on issue #37114:
URL: https://github.com/apache/superset/issues/37114#issuecomment-3954181425

   **Proposed Fix**
   
   I investigated the cache key mismatch when `GLOBAL_ASYNC_QUERIES` is enabled and confirmed that formatting differences in ad-hoc SQL expressions can produce different `QueryObject.cache_key()` values between the web process and Celery workers.
   
   While `where` and `having` clauses are sanitized during `validate()`, ad-hoc SQL expressions in the following fields were not normalized prior to hashing:
   
   * `metrics` (adhoc SQL)
   * `columns` (adhoc SQL)
   * `orderby` (adhoc SQL)
   
   Differences such as:
   
   * `\r\n` vs `\n`
   * leading/trailing whitespace
   
   result in different `to_dict()` outputs and therefore different cache keys, which can lead to HTTP 422 errors in async mode.
   
   ---
   
   **Proposed Change**
   
   I implemented a minimal and safe normalization step inside `QueryObject.cache_key()`:
   
   * Use `copy.deepcopy(self.to_dict())` to avoid mutating the original object.
   * Normalize ad-hoc SQL expressions by:
   
     * Converting `\r\n` → `\n`
     * Stripping leading/trailing whitespace
   * Apply this only when `expressionType == "SQL"` (defensive guard).
   * Do not render Jinja templates or alter execution lifecycle.
   
   This keeps the change strictly within the hashing layer and avoids introducing request/context dependency.
   
   ---
   
   **Verification**
   
   * Reproduced mismatch with CRLF vs LF and whitespace differences.
   * Added unit tests covering:
   
     * CRLF/LF parity
     * Mixed newline cases
     * Whitespace differences
     * Defensive `orderby` structures
     * No mutation guarantee
   * Confirmed async queries no longer produce 422 due to formatting differences.
   
   If this approach looks acceptable, I’ll open a PR with the changes and accompanying tests.
   
   


-- 
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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

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

   <!-- Answer -->
   You're correct—[PR #35419](https://github.com/apache/superset/pull/35419) only normalizes and sanitizes the `where` and `having` clauses before cache key generation. It does not address `orderby.sqlExpression`, so cache key mismatches due to formatting differences or Jinja rendering in `orderby.sqlExpression` remain unresolved. This is a known gap and can still cause cache misses and async query errors if, for example, newlines or template output differ between the web UI and worker processes. There isn't an official fix for this yet—workarounds are still needed for charts that rely on custom SQL in order by clauses. 
   
   If you need more details on possible workarounds or want to track this gap, let me know!
   
   
   <!-- 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/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/40f5d22e-d5fe-4455-86e5-5d4a0adb569c?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)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=You%27re%20correct%E2%80%94%5BPR%20%2335419%5D%28https%3A//github.com/apache/superset/pull/35419%29%20only%20normalizes%20and%20sanitizes%20the%20%60where%60%20and%20%60having%60%20clauses%20before%20cache%20key%20generation.%20It%20does%20not%20address%20%60orderby.sqlExpression%60%2C%20so%20cache%20key%20mismatches%20due%20to%20formatting%20differences%20or%20Jinja%20rendering%20in%20%60orderby.sqlExpression%60%20remain%20unresolved.%20This%20is%20a%20known%20gap%20and%20can%20still%20cause%20cache%20misses%20and%20async%20query%20errors%20if%2C%20for%20example%2C%20newlines%20or%20template%20output%20differ%20between%20the%20web%20UI%20and%20worker%20processes.%20There%20isn%27t%20an%20official%20fix%20for%20this%20yet%E2%80%94workarounds%20are%
 20still%20needed%20for%20charts%20that%20rely%20on%20custom%20SQL%20in%20order%20by%20clauses.%20%0A%0AIf%20you%20need%20more%20details%20on%20possible%20workarounds%20or%20want%20to%20track%20this%20gap%2C%20let%20me%20know%21)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&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/37114)


-- 
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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida closed issue #37114: enabling async execution results in HTTP error 422 - Unprocessable Content
URL: https://github.com/apache/superset/issues/37114


-- 
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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

Posted by "jenwitteng (via GitHub)" <gi...@apache.org>.
jenwitteng commented on issue #37114:
URL: https://github.com/apache/superset/issues/37114#issuecomment-3748504942

   seem https://github.com/apache/superset/pull/35419 only sanity for **where** and **having** but not **orderby.sqlExpression**


-- 
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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

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

   <!-- Answer -->
   This is a known bug in Superset 5.0.0: enabling async queries with custom SQL metrics containing newlines (\r\n vs \n) or Jinja templates causes cache key mismatches between the web UI and Celery worker, resulting in HTTP 422 errors and failed data loads. The root cause is that cache key generation does not normalize SQL expressions or template rendering, so the cache key for writing and reading can differ if the SQL formatting or template output changes ([details](https://github.com/apache/superset/issues/35991), [details](https://github.com/apache/superset/issues/35226)).
   
   A fix was merged after 5.0.0 in [PR #35419](https://github.com/apache/superset/pull/35419), which sanitizes SQL clauses before cache key generation and ensures consistent hashing regardless of newlines or whitespace. To resolve this, you’ll need to upgrade to a version that includes this PR.
   
   If you can’t upgrade, workarounds include disabling async queries (`GLOBAL_ASYNC_QUERIES = False`), avoiding Jinja templates in chart filters, or using CASE WHEN statements or virtual datasets for dynamic SQL logic. Using `url_param('param', add_to_cache_keys=False)` in Jinja templates is another workaround, but it breaks filtering ([see workaround discussion](https://github.com/apache/superset/issues/35226)).
   
   About the default `ORDER BY <metrics></metrics>`: Superset’s chart queries often auto-generate an ORDER BY clause based on selected metrics to ensure deterministic results and proper sorting, especially for time series and aggregated charts. This is standard behavior in the query builder.
   
   Let me know if you need more details on upgrading or implementing a workaround.
   
   
   <!-- 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/df6bfcca-598c-4f2f-bdc8-582043f90d96?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/df6bfcca-598c-4f2f-bdc8-582043f90d96?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/df6bfcca-598c-4f2f-bdc8-582043f90d96?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/df6bfcca-598c-4f2f-bdc8-582043f90d96?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/df6bfcca-598c-4f2f-bdc8-582043f90d96?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/df6bfcca-598c-4f2f-bdc8-582043f90d96?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/df6bfcca-598c-4f2f-bdc8-582043f90d96?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)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20bug%20in%20Superset%205.0.0%3A%20enabling%20async%20queries%20with%20custom%20SQL%20metrics%20containing%20newlines%20%28%5Cr%5Cn%20vs%20%5Cn%29%20or%20Jinja%20templates%20causes%20cache%20key%20mismatches%20between%20the%20web%20UI%20and%20Celery%20worker%2C%20resulting%20in%20HTTP%20422%20errors%20and%20failed%20data%20loads.%20The%20root%20cause%20is%20that%20cache%20key%20generation%20does%20not%20normalize%20SQL%20expressions%20or%20template%20rendering%2C%20so%20the%20cache%20key%20for%20writing%20and%20reading%20can%20differ%20if%20the%20SQL%20formatting%20or%20template%20output%20changes%20%28%5Bdetails%5D%28https%3A//github.com/apache/superset/issues/35991%29%2C%20%5Bdetails%5D%28https%3A//github.com/apache/superset
 /issues/35226%29%29.%0A%0AA%20fix%20was%20merged%20after%205.0.0%20in%20%5BPR%20%2335419%5D%28https%3A//github.com/apache/superset/pull/35419%29%2C%20which%20sanitizes%20SQL%20clauses%20before%20cache%20key%20generation%20and%20ensures%20consistent%20hashing%20regardless%20of%20newlines%20or%20whitespace.%20To%20resolve%20this%2C%20you%E2%80%99ll%20need%20to%20upgrade%20to%20a%20version%20that%20includes%20this%20PR.%0A%0AIf%20you%20can%E2%80%99t%20upgrade%2C%20workarounds%20include%20disabling%20async%20queries%20%28%60GLOBAL_ASYNC_QUERIES%20%3D%20False%60%29%2C%20avoiding%20Jinja%20templates%20in%20chart%20filters%2C%20or%20using%20CASE%20WHEN%20statements%20or%20virtual%20datasets%20for%20dynamic%20SQL%20logic.%20Using%20%60url_param%28%27param%27%2C%20add_to_cache_keys%3DFalse%29%60%20in%20Jinja%20templates%20is%20another%20workaround%2C%20but%20it%20breaks%20filtering%20%28%5Bsee%20workaround%20discussion%5D%28https%3A//github.com/apache/superset/issues/35226%29%29.%0A%0AAbout%
 20the%20default%20%60ORDER%20BY%20%3Cmetrics%3E%3C/metrics%3E%60%3A%20Superset%E2%80%99s%20chart%20queries%20often%20auto-generate%20an%20ORDER%20BY%20clause%20based%20on%20selected%20metrics%20to%20ensure%20deterministic%20results%20and%20proper%20sorting%2C%20especially%20for%20time%20series%20and%20aggregated%20charts.%20This%20is%20standard%20behavior%20in%20the%20query%20builder.%0A%0ALet%20me%20know%20if%20you%20need%20more%20details%20on%20upgrading%20or%20implementing%20a%20workaround.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&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/37114)


-- 
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] enabling async execution results in HTTP error 422 - Unprocessable Content [superset]

Posted by "jenwitteng (via GitHub)" <gi...@apache.org>.
jenwitteng commented on issue #37114:
URL: https://github.com/apache/superset/issues/37114#issuecomment-3748538046

   **Case /r/n**
   writing cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': [{'timeGrain': 'P1M', 'columnType': 'BASE_AXIS', 'sqlExpression': 'booking_datetime_cast', 'label': 'booking_datetime_cast', 'expressionType': 'SQL'}], 'extras': {'time_grain_sqla': 'P1M', 'having': '', 'where': ''}, 'filter': [{'col': 'whitelabel_name', 'op': 'IN', 'val': ['RMNectar']}, {'col': 'booking_datetime_cast', 'op': 'TEMPORAL_RANGE', 'val': 'DATEADD(DATETIME("now"), -7, day) : now'}], 'from_dttm': datetime.datetime(2026, 1, 6, 9, 1, 55), 'granularity': None, 'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowcount': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) < 0.16\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no
 _of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '16% - 20% Spread', 'optionName': 'metric_wqmh9wx1z2_ymlki2up3dn', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.16\r\n        AND cast(original_total_spread_percentage as float) < 0.2\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '20% - 25% Spread', 'optionName': 'metric_5egn3fc8zja_1b16x3da4md', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.20\r\n        AND cast(original_total_spread_percentage as float) < 0.25\r\n      THEN CASE\r\n            WH
 EN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '25% - 30% Spread', 'optionName': 'metric_loo72lfax59_rta69r6ml5', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.25\r\n        AND cast(original_total_spread_percentage as float) < 0.30\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '>= 30% Spread', 'optionName': 'metric_46nrvjqbi3t_cnxe56gcyl8', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.30\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_o
 f_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}], 'order_desc': True, 'orderby': [({'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) < 0.16\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, False)], 'row_limit': 10000, 'row_offset': 0, 'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 'to_dttm': datetime.datetime(2026, 1, 13, 9, 1, 55), 'time_shift': None, 'conditional_formatting': None, 'comments': None}
   
   reading cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': [{'timeGrain': 'P1M', 'columnType': 'BASE_AXIS', 'sqlExpression': 'booking_datetime_cast', 'label': 'booking_datetime_cast', 'expressionType': 'SQL'}], 'extras': {'where': '', 'having': '', 'time_grain_sqla': 'P1M'}, 'filter': [{'val': ['RMNectar'], 'op': 'IN', 'col': 'whitelabel_name'}, {'val': 'DATEADD(DATETIME("now"), -7, day) : now', 'op': 'TEMPORAL_RANGE', 'col': 'booking_datetime_cast'}], 'from_dttm': datetime.datetime(2026, 1, 6, 9, 2, 8), 'granularity': None, 'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowcount': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) < 0.16\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_
 of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '16% - 20% Spread', 'optionName': 'metric_wqmh9wx1z2_ymlki2up3dn', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.16\r\n        AND cast(original_total_spread_percentage as float) < 0.2\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '20% - 25% Spread', 'optionName': 'metric_5egn3fc8zja_1b16x3da4md', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.20\r\n        AND cast(original_total_spread_percentage as float) < 0.25\r\n      THEN CASE\r\n            WHE
 N tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '25% - 30% Spread', 'optionName': 'metric_loo72lfax59_rta69r6ml5', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.25\r\n        AND cast(original_total_spread_percentage as float) < 0.30\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_of_room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}, {'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '>= 30% Spread', 'optionName': 'metric_46nrvjqbi3t_cnxe56gcyl8', 'sqlExpression': "SUM(CASE \r\n      WHEN cast(original_total_spread_percentage as float) >= 0.30\r\n      THEN CASE\r\n            WHEN tbl_source = 'PPA' THEN hotel_no_of
 _room\r\n            WHEN tbl_source = 'TR' THEN 1\r\n            END\r\n    END)"}], 'order_desc': True, 'orderby': [({'aggregate': None, 'column': None, 'datasourceWarning': False, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': '< 16% Spread', 'optionName': 'metric_d7ocbaa3aq_k1i0msjgad', 'sqlExpression': "SUM(CASE \n      WHEN cast(original_total_spread_percentage as float) < 0.16\n      THEN CASE\n            WHEN tbl_source = 'PPA' THEN hotel_no_of_room\n            WHEN tbl_source = 'TR' THEN 1\n            END\n    END)"}, False)], 'row_limit': 10000, 'row_offset': 0, 'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 'to_dttm': datetime.datetime(2026, 1, 13, 9, 2, 8), 'time_shift': None, 'conditional_formatting': None, 'comments': None}
   
   **case jinja template**
   writing cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': [{'timeGrain': 'P3M', 'columnType': 'BASE_AXIS', 'sqlExpression': 'merge_request_merged_at', 'label': 'merge_request_merged_at', 'expressionType': 'SQL'}], 'extras': {'having': '', 'where': '', 'time_grain_sqla': 'P3M'}, 'filter': [{'val': ['Yes'], 'op': 'IN', 'col': 'yes_no_condition'}, {'val': ['No'], 'op': 'IN', 'col': 'is_intern_included'}, {'val': ['No'], 'op': 'IN', 'col': 'is_freezing_period_included'}, {'val': ['No'], 'op': 'IN', 'col': 'is_inactivity_included'}, {'val': [False], 'op': 'IN', 'col': 'true_false_bool_condition'}, {'val': 75, 'op': '==', 'col': 'percentile'}, {'val': ['System owner'], 'op': 'IN', 'col': 'calculated_by'}, {'val': 'datetrunc(dateadd(datetime("today"), -1, quarter), quarter) : datetime("today")', 'op': 'TEMPORAL_RANGE', 'col': 'merge_request_merged_at'}], 'from_dttm': datetime.datetime(2025, 10, 1, 0, 0), 'granularity': None, 'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowco
 unt': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': None, 'datasourceWarning': True, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': 'MLTC', 'optionName': 'metric_25y7eu1dboh_x7xp5sc9x2', 'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0] %}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS percentile={{ no_of_mrs }}/100)"}], 'order_desc': True, 'orderby': [({'aggregate': None, 'column': None, 'datasourceWarning': True, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': 'MLTC', 'optionName': 'metric_25y7eu1dboh_x7xp5sc9x2', 'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0] %}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS percentile={{ no_of_mrs }}/100)"}, False)], 'row_limit': 10000, 'row_offset': 0, 'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 'to_dttm': datetime.datetime(2026, 1, 14, 0, 0), 'time_shift': None, 'conditional_formatting': N
 one, 'comments': None}
   
   reading cache
   
   > query_dict={'apply_fetch_values_predicate': False, 'columns': [{'timeGrain': 'P3M', 'columnType': 'BASE_AXIS', 'sqlExpression': 'merge_request_merged_at', 'label': 'merge_request_merged_at', 'expressionType': 'SQL'}], 'extras': {'time_grain_sqla': 'P3M', 'where': '', 'having': ''}, 'filter': [{'val': ['Yes'], 'col': 'yes_no_condition', 'op': 'IN'}, {'val': ['No'], 'col': 'is_intern_included', 'op': 'IN'}, {'val': ['No'], 'col': 'is_freezing_period_included', 'op': 'IN'}, {'val': ['No'], 'col': 'is_inactivity_included', 'op': 'IN'}, {'val': [False], 'col': 'true_false_bool_condition', 'op': 'IN'}, {'val': 75, 'col': 'percentile', 'op': '=='}, {'val': ['System owner'], 'col': 'calculated_by', 'op': 'IN'}, {'val': 'datetrunc(dateadd(datetime("today"), -1, quarter), quarter) : datetime("today")', 'col': 'merge_request_merged_at', 'op': 'TEMPORAL_RANGE'}], 'from_dttm': datetime.datetime(2025, 10, 1, 0, 0), 'granularity': None, 'inner_from_dttm': None, 'inner_to_dttm': None, 'is_rowco
 unt': False, 'is_timeseries': False, 'metrics': [{'aggregate': None, 'column': None, 'datasourceWarning': True, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': 'MLTC', 'optionName': 'metric_25y7eu1dboh_x7xp5sc9x2', 'sqlExpression': "{% set no_of_mrs = filter_values('percentile')[0] %}\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS percentile={{ no_of_mrs }}/100)"}], 'order_desc': True, 'orderby': [({'aggregate': None, 'column': None, 'datasourceWarning': True, 'expressionType': 'SQL', 'hasCustomLabel': True, 'label': 'MLTC', 'optionName': 'metric_25y7eu1dboh_x7xp5sc9x2', 'sqlExpression': '\n\nAPPROXIMATE_PERCENTILE((office_hour_mltc/(60*9)) USING PARAMETERS percentile=75/100)'}, False)], 'row_limit': 10000, 'row_offset': 0, 'series_columns': [], 'series_limit': 0, 'series_limit_metric': None, 'to_dttm': datetime.datetime(2026, 1, 14, 0, 0), 'time_shift': None, 'conditional_formatting': None, 'comments': None}


-- 
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