Skip to content

Commit 8d3b1cb

Browse files
committed
Bumping version to 0.2.0
1 parent 21de8b1 commit 8d3b1cb

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Utility belt to handle data on AWS.
44
5-
[![Release](https://img.shields.io/badge/release-0.1.4-brightgreen.svg)](https://pypi.org/project/awswrangler/)
5+
[![Release](https://img.shields.io/badge/release-0.2.0-brightgreen.svg)](https://pypi.org/project/awswrangler/)
66
[![Downloads](https://img.shields.io/pypi/dm/awswrangler.svg)](https://pypi.org/project/awswrangler/)
77
[![Python Version](https://img.shields.io/badge/python-3.6%20%7C%203.7-brightgreen.svg)](https://pypi.org/project/awswrangler/)
88
[![Documentation Status](https://readthedocs.org/projects/aws-data-wrangler/badge/?version=latest)](https://aws-data-wrangler.readthedocs.io/en/latest/?badge=latest)

awswrangler/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__title__ = "awswrangler"
22
__description__ = "Utility belt to handle data on AWS."
3-
__version__ = "0.1.4"
3+
__version__ = "0.2.0"
44
__license__ = "Apache License 2.0"

awswrangler/pandas.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,13 @@ def to_aurora(self,
15241524
engine=engine,
15251525
region=region)
15261526

1527-
self._session.s3.delete_objects(path=temp_s3_path, procs_io_bound=procs_io_bound)
1527+
if "postgres" in engine.lower():
1528+
self._session.s3.delete_listed_objects(objects_paths=load_paths, procs_io_bound=procs_io_bound)
1529+
elif "mysql" in engine.lower():
1530+
self._session.s3.delete_listed_objects(objects_paths=load_paths + [manifest_path],
1531+
procs_io_bound=procs_io_bound)
1532+
else:
1533+
raise InvalidEngine(f"{engine} is not a valid engine. Please use 'mysql' or 'postgres'!")
15281534

15291535
def read_sql_aurora(self,
15301536
sql: str,

testing/test_awswrangler/test_glue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ def test_get_tables_search(session, table):
114114

115115

116116
def test_get_tables_prefix(session, table):
117-
tables = list(session.glue.get_tables(prefix=table[:-1]))
117+
tables = list(session.glue.get_tables(name_prefix=table[:-1]))
118118
assert len(tables) > 0
119119
for tbl in tables:
120120
if tbl["Name"] == table:
121121
assert tbl["TableType"] == "EXTERNAL_TABLE"
122122

123123

124124
def test_get_tables_suffix(session, table):
125-
tables = list(session.glue.get_tables(suffix=table[1:]))
125+
tables = list(session.glue.get_tables(name_suffix=table[1:]))
126126
assert len(tables) > 0
127127
for tbl in tables:
128128
if tbl["Name"] == table:

testing/test_awswrangler/test_pandas.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,8 @@ def test_aurora_mysql_load_append(bucket, mysql_parameters):
18301830

18311831

18321832
def test_aurora_postgres_load_append(bucket, postgres_parameters):
1833-
df = pd.DataFrame({"id": [1, 2, 3], "value": ["foo", "boo", "bar"]})
1833+
n: int = 10_000
1834+
df = pd.DataFrame({"id": list((range(n))), "value": list(["foo" if i % 2 == 0 else "boo" for i in range(n)])})
18341835
conn = Aurora.generate_connection(database="postgres",
18351836
host=postgres_parameters["PostgresAddress"],
18361837
port=3306,

testing/test_awswrangler/test_sagemaker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def model(bucket):
7070
def model_empty(bucket):
7171
model_path = "output_empty/model.tar.gz"
7272

73-
with tarfile.open("model.tar.gz", "w:gz") as tar:
73+
with tarfile.open("model.tar.gz", "w:gz"):
7474
pass
7575

7676
s3 = boto3.resource("s3")

testing/test_awswrangler/test_spark.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
from datetime import datetime, date
3+
from time import sleep
34

45
import pytest
56
import boto3
@@ -88,6 +89,8 @@ def test_read_csv(session, bucket, sample_name):
8889
[("snappy", []), ("gzip", ["date", "value"]), ("none", ["time"])],
8990
)
9091
def test_create_glue_table_parquet(session, bucket, database, compression, partition_by):
92+
s3_path = f"s3://{bucket}/test"
93+
session.s3.delete_objects(path=s3_path)
9194
path = "data_samples/nano.csv"
9295
schema = "id INTEGER, name STRING, value DOUBLE, date DATE, time TIMESTAMP"
9396
timestamp_format = "yyyy-MM-dd"
@@ -100,12 +103,12 @@ def test_create_glue_table_parquet(session, bucket, database, compression, parti
100103
.withColumn("my_array", array(lit(0), lit(1))) \
101104
.withColumn("my_struct", struct(lit("text").alias("a"), lit(1).alias("b"))) \
102105
.withColumn("my_map", create_map(lit("k0"), lit(1.0), lit("k1"), lit(2.0)))
103-
s3_path = f"s3://{bucket}/test"
104106
dataframe.write \
105107
.mode("overwrite") \
106108
.format("parquet") \
107109
.partitionBy(partition_by) \
108110
.save(compression=compression, path=s3_path)
111+
sleep(10)
109112
session.spark.create_glue_table(dataframe=dataframe,
110113
file_format="parquet",
111114
partition_by=partition_by,
@@ -119,6 +122,7 @@ def test_create_glue_table_parquet(session, bucket, database, compression, parti
119122
assert pandas_df.iloc[0]["counter"] == 5
120123
query = "select my_array[1] as foo, my_struct.a as boo, my_map['k0'] as bar from test limit 1"
121124
pandas_df = session.pandas.read_sql_athena(sql=query, database=database)
125+
session.s3.delete_objects(path=s3_path)
122126
assert pandas_df.iloc[0]["foo"] == 0
123127
assert pandas_df.iloc[0]["boo"] == "text"
124128
assert pandas_df.iloc[0]["bar"] == 1.0

0 commit comments

Comments
 (0)