diff --git a/awswrangler/data_api/rds.py b/awswrangler/data_api/rds.py index 53e57856c..2e37e0ad3 100644 --- a/awswrangler/data_api/rds.py +++ b/awswrangler/data_api/rds.py @@ -359,6 +359,9 @@ def _create_value_dict( # noqa: PLR0911 if isinstance(value, Decimal): return {"stringValue": str(value)}, "DECIMAL" + if isinstance(value, uuid.UUID): + return {"stringValue": str(value)}, "UUID" + raise exceptions.InvalidArgumentType(f"Value {value} not supported.") diff --git a/tests/unit/test_data_api.py b/tests/unit/test_data_api.py index d3a1829b4..2657ccd24 100644 --- a/tests/unit/test_data_api.py +++ b/tests/unit/test_data_api.py @@ -1,5 +1,6 @@ from __future__ import annotations +import uuid from typing import Any, Iterator import boto3 @@ -284,7 +285,8 @@ def test_data_api_mysql_ansi(mysql_serverless_connector: "RdsDataApi", mysql_ser def test_data_api_postgresql(postgresql_serverless_connector: "RdsDataApi", postgresql_serverless_table: str) -> None: database = "test" - frame = pd.DataFrame([[42, "test"]], columns=["id", "name"]) + _id = uuid.uuid4() + frame = pd.DataFrame([[_id, "test"]], columns=["id", "name"]) wr.data_api.rds.to_sql( df=frame, @@ -295,7 +297,7 @@ def test_data_api_postgresql(postgresql_serverless_connector: "RdsDataApi", post ) out_frame = wr.data_api.rds.read_sql_query( - f"SELECT name FROM {postgresql_serverless_table} WHERE id = 42", con=postgresql_serverless_connector + f"SELECT name FROM {postgresql_serverless_table} WHERE id = '{_id}'", con=postgresql_serverless_connector ) expected_dataframe = pd.DataFrame([["test"]], columns=["name"]) assert_pandas_equals(out_frame, expected_dataframe)