Skip to content

Commit e58a8b7

Browse files
committed
Add s3_write_modes.ipynb tutorial
1 parent 81ef7e7 commit e58a8b7

File tree

5 files changed

+507
-18
lines changed

5 files changed

+507
-18
lines changed

README.md

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

1313
**[Read the Docs!](https://aws-data-wrangler.readthedocs.io)**
1414

15-
**[Read the Tutorials](https://github.com/awslabs/aws-data-wrangler/tree/master/tutorials): [Catalog & Metadata](https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/catalog_and_metadata.ipynb) | [Athena Nested](https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/athena_nested.ipynb)**
15+
**[Read the Tutorials](https://github.com/awslabs/aws-data-wrangler/tree/master/tutorials): [Catalog & Metadata](https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/catalog_and_metadata.ipynb) | [Athena Nested](https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/athena_nested.ipynb) | [S3 Write Modes](https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/s3_write_modes.ipynb)**
1616

1717
---
1818

awswrangler/glue.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Dict, Optional, Any, Iterator, List
1+
from typing import TYPE_CHECKING, Dict, Optional, Any, Iterator, List, Union
22
from math import ceil
33
from itertools import islice
44
import re
@@ -64,7 +64,7 @@ def metadata_to_glue(self,
6464
mode: str = "append",
6565
compression=None,
6666
cast_columns=None,
67-
extra_args=None,
67+
extra_args: Optional[Dict[str, Optional[Union[str, int]]]] = None,
6868
description: Optional[str] = None,
6969
parameters: Optional[Dict[str, str]] = None,
7070
columns_comments: Optional[Dict[str, str]] = None) -> None:
@@ -269,9 +269,13 @@ def parse_table_name(path):
269269
return path.rpartition("/")[2]
270270

271271
@staticmethod
272-
def csv_table_definition(table, partition_cols_schema, schema, path, compression, extra_args=None):
272+
def csv_table_definition(table, partition_cols_schema, schema, path, compression, extra_args: Optional[Dict[str, Optional[Union[str, int]]]] = None):
273273
if extra_args is None:
274-
extra_args = {}
274+
extra_args = {
275+
"sep": None
276+
}
277+
if extra_args.get("sep") is None:
278+
extra_args["sep"] = ","
275279
if partition_cols_schema is None:
276280
partition_cols_schema = []
277281
compressed = False if compression is None else True

docs/source/index.rst

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

1111
*Utility belt to handle data on AWS.*
1212

13-
`Read the Tutorials <https://github.com/awslabs/aws-data-wrangler/tree/master/tutorials>`_: `Catalog & Metadata <https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/catalog_and_metadata.ipynb>`_ | `Athena Nested <https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/athena_nested.ipynb>`_
13+
`Read the Tutorials <https://github.com/awslabs/aws-data-wrangler/tree/master/tutorials>`_: `Catalog & Metadata <https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/catalog_and_metadata.ipynb>`_ | `Athena Nested <https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/athena_nested.ipynb>`_ | `S3 Write Modes <https://github.com/awslabs/aws-data-wrangler/blob/master/tutorials/s3_write_modes.ipynb>`_
1414

1515
Use Cases
1616
---------

testing/test_awswrangler/test_pandas.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,12 +1933,9 @@ def test_aurora_postgres_load_special(bucket, postgres_parameters):
19331933
"value": ["foo", "boo", "bar", "abc"],
19341934
"slashes": ["\\", "\"", "\\\\\\\\", "\"\"\"\""],
19351935
"floats": [1.0, 2.0, 3.0, 4.0],
1936-
"decimals": [
1937-
Decimal((0, (1, 9, 9), -2)),
1938-
Decimal((0, (1, 9, 9), -2)),
1939-
Decimal((0, (1, 9, 0), -2)),
1940-
None
1941-
]
1936+
"decimals": [Decimal((0, (1, 9, 9), -2)),
1937+
Decimal((0, (1, 9, 9), -2)),
1938+
Decimal((0, (1, 9, 0), -2)), None]
19421939
})
19431940

19441941
path = f"s3://{bucket}/test_aurora_postgres_special"
@@ -1988,12 +1985,9 @@ def test_aurora_mysql_load_special(bucket, mysql_parameters):
19881985
"value": ["foo", "boo", "bar", "abc"],
19891986
"slashes": ["\\", "\"", "\\\\\\\\", "\"\"\"\""],
19901987
"floats": [1.0, 2.0, 3.0, 4.0],
1991-
"decimals": [
1992-
Decimal((0, (1, 9, 9), -2)),
1993-
Decimal((0, (1, 9, 9), -2)),
1994-
Decimal((0, (1, 9, 0), -2)),
1995-
None
1996-
]
1988+
"decimals": [Decimal((0, (1, 9, 9), -2)),
1989+
Decimal((0, (1, 9, 9), -2)),
1990+
Decimal((0, (1, 9, 0), -2)), None]
19971991
})
19981992

19991993
path = f"s3://{bucket}/test_aurora_mysql_special"

0 commit comments

Comments
 (0)