File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
builtin/core/data/queries/shared Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1+ CREATE OR REPLACE VIEW ${athena_view_name} AS
2+ SELECT DISTINCT
3+ line_item_usage_account_id account_id,
4+ MAX_BY(bill_payer_account_id, line_item_usage_start_date) parent_account_id,
5+ MAX_BY(line_item_usage_account_id, line_item_usage_start_date) account_name,
6+ MAX_BY(line_item_usage_account_id, line_item_usage_start_date) account_email_id
7+ FROM
8+ " ${cur_table_name}"
9+ GROUP BY
10+ line_item_usage_account_id
Original file line number Diff line number Diff line change @@ -156,24 +156,16 @@ def create(self, name) -> bool:
156156 def get_dummy_account_mapping_sql (self , name ) -> list :
157157 """Create dummy account mapping"""
158158 logger .info (f'Creating dummy account mapping for { name } ' )
159- template_str = '''CREATE OR REPLACE VIEW ${athena_view_name} AS SELECT DISTINCT
160- line_item_usage_account_id account_id, bill_payer_account_id parent_account_id,
161- line_item_usage_account_id account_name, line_item_usage_account_id account_email_id
162- FROM
163- "${cur_table_name}"
164- '''
165- template = Template (template_str )
166- # Fill in TPLs
167- columns_tpl = dict ()
168- parameters = {
159+ template = Template (resource_string (
160+ package_or_requirement = 'cid.builtin.core' ,
161+ resource_name = 'data/queries/shared/account_map_dummy.sql' ,
162+ ).decode ('utf-8' ))
163+ columns_tpl = {
169164 'athena_view_name' : name ,
170165 'cur_table_name' : self .cur .tableName
171166 }
172- columns_tpl .update (** parameters )
173167 compiled_query = template .safe_substitute (columns_tpl )
174-
175168 return compiled_query
176-
177169
178170 def get_organization_accounts (self ) -> list :
179171 """ Retreive AWS Organization account """
You can’t perform that action at this time.
0 commit comments