Skip to content

Commit

Permalink
allow resource_tags to be unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Dec 26, 2024
1 parent ba4d3b8 commit 18f1ebd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cid/helpers/cur_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,13 @@ def get_sql_expression(self, field, field_type):
else:
raise NotImplementedError(f'CUR1 field {field} has no known equivalent')
if self.current_cur_version.startswith('2') and self.target_cur_version.startswith('1'):
if field.startswith('resource_tags_'):
return f"resource_tags['{field[len('resource_tags_'):]}']"
if field.startswith('cost_category_'):
return f"cost_category['{field[len('cost_category_'):]}']"
return cur1to2_mapping.get(field, field)
for tag_type in 'resource_tags', 'cost_category':
if field.startswith(tag_type + '_'):
short_field_name = field[len(tag_type + '_'):]
if short_field_name.encode('unicode-escape').decode('ascii') != short_field_name:
# name contains unicode characters that must be escaped
short_field_name = f'"{short_field_name}"'
return f"{tag_type}['{short_field_name}']"


def column_surely_exist(self, field_to_expose):
Expand Down

0 comments on commit 18f1ebd

Please sign in to comment.