Skip to content

Commit

Permalink
Filter accounts by matching criteria during subs processing to preven…
Browse files Browse the repository at this point in the history
…t unnecessary SQL from running (#5184)
  • Loading branch information
cgoodfred authored and djnakabaale committed Jul 9, 2024
1 parent e29e407 commit 8cbfd22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions koku/subs/trino_sql/aws/determine_ids_for_provider.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM hive.{{schema | sqlsafe}}.aws_line_items
WHERE source={{source_uuid}}
AND year={{year}}
AND month={{month}}
AND lineitem_productcode = 'AmazonEC2'
AND strpos(lower(resourcetags), 'com_redhat_rhel') > 0
{% if excluded_ids %}
AND lineitem_usageaccountid NOT IN {{excluded_ids | inclause}}
{% endif %}
3 changes: 3 additions & 0 deletions koku/subs/trino_sql/azure/determine_ids_for_provider.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM hive.{{schema | sqlsafe}}.azure_line_items
WHERE source={{source_uuid}}
AND year={{year}}
AND month={{month}}
AND metercategory = 'Virtual Machines'
AND json_extract_scalar(lower(additionalinfo), '$.vcpus') IS NOT NULL
AND json_extract_scalar(lower(tags), '$.com_redhat_rhel') IS NOT NULL
{% if excluded_ids %}
AND COALESCE(NULLIF(subscriptionid, ''), subscriptionguid) NOT IN {{excluded_ids | inclause}}
{% endif %}

0 comments on commit 8cbfd22

Please sign in to comment.