fix(cur_proxy): Return SQL expression instead of None for CUR2→CUR1 proxy fields#1500
Open
NithinChandranR-AWS wants to merge 1 commit into
Conversation
…roxy fields get_sql_expression() has an incomplete code path when current_cur_version='2' and target_cur_version='1'. For fields that are not resource_tags or cost_category prefixed (e.g. month, year, product_sku), the function falls through without a return statement, producing Python None which gets interpolated as the literal string 'None' in SQL queries. Fix: after the tag loop, look up the field in cur1to2_mapping (which contains the CUR2 SQL expression for each CUR1 field name). If not found, return a typed NULL cast. This fixes PCA dashboard deployment for CUR 2.0-only accounts. Fixes aws-solutions-library-samples#1498
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
get_sql_expression() in cur_proxy.py has an incomplete code path when current_cur_version='2' and target_cur_version='1'. For non-tag fields (e.g. month, year, product_sku), the function falls through without a return, producing Python None which gets interpolated as literal 'None' in SQL.
PCA dashboard is broken for CUR 2.0-only customers.
Fix
After the tag/cost_category loop, look up the field in cur1to2_mapping (CUR1→CUR2 SQL equivalents). If not found, return typed NULL.
Fixes #1498