Skip to content

Commit

Permalink
Added aws provider conversion config.
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Mittal <varunmittal91@gmail.com>
  • Loading branch information
varunmittal91 committed Oct 9, 2023
1 parent eee32d9 commit 7d20c2d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
plan_name: Assign provider
conversion_type: static_value
conversion_args:
static_value: AWS
column: NA
focus_column: Provider
3 changes: 0 additions & 3 deletions focus_converter_base/focus_converter/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ def prepare_horizontal_conversion_plan(self, provider):
# sql queries collected to be applied on the lazy frame
self.h_sql_queries = sql_queries = []

# add provider by default to our column expressions
column_exprs.append(ColumnFunctions.add_provider(provider=provider))

for plan in self.plans[provider]:
# column name generated with temporary prefix
if plan.column_prefix:
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from unittest import TestCase
from unittest.mock import patch, PropertyMock

import pandas as pd
import polars as pl

from focus_converter.configs.base_config import ConversionPlan
from focus_converter.conversion_functions.column_functions import ColumnFunctions
from focus_converter.converter import FocusConverter


class TestAWSProvider(TestCase):
def test_aws_provider_config(self):
conversion_plan = ConversionPlan.load_yaml(
"focus_converter/conversion_configs/aws/D011_S001.yaml"
)

focus_converter = FocusConverter()
focus_converter.plans = {"aws": [conversion_plan]}
column_exprs = focus_converter.prepare_horizontal_conversion_plan(
provider="aws"
)

test_dataframe = pd.DataFrame([{"a": 1}])

test_pl_df = (
pl.from_dataframe(test_dataframe)
.lazy()
.with_columns(column_exprs)
.collect()
)
self.assertEqual(list(test_pl_df["Provider"])[0], "AWS")

0 comments on commit 7d20c2d

Please sign in to comment.