How to use the awswrangler.Session function in awswrangler

To help you get started, we’ve selected a few awswrangler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awslabs / aws-data-wrangler / testing / test_awswrangler / test_pandas.py View on Github external
@pytest.fixture(scope="module")
def session(database):
    yield Session(athena_database=database)
github awslabs / aws-data-wrangler / testing / test_awswrangler / test_session.py View on Github external
def test_from_boto3_keys(default_session):
    assert_account_id(
        Session(
            aws_access_key_id=default_session.aws_access_key_id,
            aws_secret_access_key=default_session.aws_secret_access_key,
        ))
github awslabs / aws-data-wrangler / testing / test_awswrangler / test_redshift.py View on Github external
def session():
    yield Session(spark_session=SparkSession.builder.appName("AWS Wrangler Test").getOrCreate())
github awslabs / aws-data-wrangler / testing / test_awswrangler / test_pandas.py View on Github external
def test_to_parquet_with_kms(
    bucket,
    database,
    kms_key,
):
    extra_args = {"ServerSideEncryption": "aws:kms", "SSEKMSKeyId": kms_key}
    session_inner = Session(s3_additional_kwargs=extra_args)
    dataframe = pd.read_csv("data_samples/nano.csv")
    path = f"s3://{bucket}/test/"
    session_inner.pandas.to_parquet(dataframe=dataframe,
                                    database=database,
                                    path=path,
                                    preserve_index=False,
                                    mode="overwrite",
                                    procs_cpu_bound=1)
    dataframe2 = None
    for counter in range(10):
        sleep(1)
        dataframe2 = session_inner.pandas.read_sql_athena(ctas_approach=False,
                                                          sql="select * from test",
                                                          database=database)
        if len(dataframe.index) == len(dataframe2.index):
            break