Skip to content

Commit a75c903

Browse files
authored
fix: Redshift VARBYTE support (#2573)
* fix: Redshift VARBYTE support Signed-off-by: Anton Kukushkin <[email protected]> * [skip ci] remove commented code Signed-off-by: Anton Kukushkin <[email protected]> * Revert test change Signed-off-by: Anton Kukushkin <[email protected]> * New linter rules Signed-off-by: Anton Kukushkin <[email protected]> --------- Signed-off-by: Anton Kukushkin <[email protected]>
1 parent b69a1ef commit a75c903

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

awswrangler/_data_types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def pyarrow2athena( # noqa: PLR0911,PLR0912
6565
raise exceptions.UnsupportedType(f"Unsupported Pyarrow type: {dtype}")
6666

6767

68-
def pyarrow2redshift( # noqa: PLR0911
68+
def pyarrow2redshift( # noqa: PLR0911,PLR0912
6969
dtype: pa.DataType, string_type: str
7070
) -> str:
7171
"""Pyarrow to Redshift data types conversion."""
@@ -93,6 +93,8 @@ def pyarrow2redshift( # noqa: PLR0911
9393
return "DATE"
9494
if pa.types.is_time(dtype):
9595
return "TIME"
96+
if pa.types.is_binary(dtype):
97+
return "VARBYTE"
9698
if pa.types.is_decimal(dtype):
9799
return f"DECIMAL({dtype.precision},{dtype.scale})"
98100
if pa.types.is_dictionary(dtype):
@@ -435,6 +437,8 @@ def athena2redshift( # noqa: PLR0911
435437
return "TIMESTAMP"
436438
if dtype == "date":
437439
return "DATE"
440+
if dtype == "binary":
441+
return "VARBYTE"
438442
if dtype.startswith("decimal"):
439443
return dtype.upper()
440444
if dtype.startswith("array") or dtype.startswith("struct"):

0 commit comments

Comments
 (0)