def __post_init__(self):
        # set up the datasets
        (
            self.target_time_series,
            self.related_time_series,
            self.item_metadata,
        ) = self._get_datasets()

        # get the dataset group (from the provided forecast)
        self.dataset_group = self.forecast._dataset_group

        # set up column mappings
        column_mappings = {}
        for n in range(1, MAX_DIMENSIONS + 1):
            column_mappings[f"dimension_{n}"] = None
        for n in range(1, MAX_METADATA_FIELDS + 1):
            column_mappings[f"metadata_{n}"] = None
        self.column_mappings = column_mappings

        # set up the connection to AWS Athena
        self.cursor = connect(
            region_name=get_aws_region(),
            work_group=self.workgroup,
            schema_name=self.schema,
            cursor_class=AsyncCursor,
        ).cursor()
    def __init__(self, quicksight_application=None, props=None):
        self.quicksight_application = quicksight_application
        self.aws_account_id = get_aws_account_id()
        self.aws_region = get_aws_region()
        self.aws_partion = get_aws_partition()
        self.principal_arn = quicksight_application.quicksight_principal_arn

        self.type = None
        self.prefix = quicksight_application.prefix

        self.id = None
        self.name = None
        self.arn = None
        self.url = None
        self.config_data = dict()
예제 #3
0
def test_region_missing():
    region = os.environ.pop("AWS_REGION")
    with pytest.raises(EnvironmentVariableError):
        get_aws_region()
    os.environ["AWS_REGION"] = region
def test_us_gov_cloud_partition(monkeypatch):
    """Set the SECRET env var to assert the behavior."""
    monkeypatch.setenv("AWS_REGION", "us-gov-east-1")
    assert get_aws_region() == "us-gov-east-1"
    assert get_aws_partition() == "aws-us-gov"
def test_cn_partition(monkeypatch):
    """Set the SECRET env var to assert the behavior."""
    monkeypatch.setenv("AWS_REGION", "cn-north-1")
    assert get_aws_region() == "cn-north-1"
    assert get_aws_partition() == "aws-cn"