Skip to content

Commit

Permalink
Revert "One approach to solve null values for subscription_name" (#4870)
Browse files Browse the repository at this point in the history
  • Loading branch information
bacciotti authored Jan 16, 2024
1 parent 961f2c4 commit 732a111
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 213 deletions.
14 changes: 1 addition & 13 deletions koku/api/report/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,6 @@ def is_aws(self):
"""Determine if we are working with an AWS API."""
return "aws" in self.parameters.request.path

@property
def is_azure(self):
"""Determine if we are working with an Azure API."""
return "azure" in self.parameters.request.path

def initialize_totals(self):
"""Initialize the total response column values."""
query_sum = {}
Expand Down Expand Up @@ -1128,8 +1123,6 @@ def _group_by_ranks(self, query, data): # noqa: C901
)
if self.is_aws and "account" in self.parameters.url_data:
ranks = ranks.annotate(**{"account_alias": F("account_alias__account_alias")})
if self.is_azure and "subscription_guid" in self.parameters.url_data:
ranks = ranks.annotate(**{"subscription_name": F("subscription_name")})
if self.is_openshift:
ranks = ranks.annotate(clusters=ArrayAgg(Coalesce("cluster_alias", "cluster_id"), distinct=True))

Expand Down Expand Up @@ -1175,10 +1168,6 @@ def _ranked_list(self, data_list, ranks, rank_fields=None): # noqa C901
drop_columns.add("account_alias")
if self.is_aws and "account" not in group_by:
rank_data_frame.drop(columns=["account_alias"], inplace=True, errors="ignore")
if self.is_azure and "subscription_guid" in group_by:
drop_columns.add("subscription_name")
if self.is_azure and "subscription_guid" not in group_by:
rank_data_frame.drop(columns=["subscription_name"], errors="ignore")

agg_fields = {}
for col in [col for col in self.report_annotations if "units" in col]:
Expand Down Expand Up @@ -1238,6 +1227,7 @@ def _ranked_list(self, data_list, ranks, rank_fields=None): # noqa C901

# Finally replace any remaining NaN with None for JSON compatibility
data_frame = data_frame.replace({np.nan: None})

return data_frame.to_dict("records")

def _aggregate_ranks_over_limit(self, data_frame, group_by):
Expand Down Expand Up @@ -1275,8 +1265,6 @@ def _aggregate_ranks_over_limit(self, data_frame, group_by):
others_data_frame["default_project"] = "False"
if self.is_aws and "account" in group_by:
others_data_frame["account_alias"] = other_str
elif self.is_azure and "subscription_guid" in group_by:
others_data_frame["subscription_name"] = other_str
elif "gcp_project" in group_by:
others_data_frame["gcp_project_alias"] = other_str

Expand Down
200 changes: 0 additions & 200 deletions koku/api/report/test/azure/test_queries.py

This file was deleted.

0 comments on commit 732a111

Please sign in to comment.