@@ -1925,10 +1925,12 @@ def test_aurora_postgres_load_special(bucket, postgres_parameters):
19251925 df = pd .DataFrame ({
19261926 "id" : [1 , 2 , 3 , 4 ],
19271927 "value" : ["foo" , "boo" , "bar" , "abc" ],
1928- "special" : ["\\ " , "\" " , "\\ \\ \\ \\ " , "\" \" \" \" " ]
1928+ "slashes" : ["\\ " , "\" " , "\\ \\ \\ \\ " , "\" \" \" \" " ],
1929+ "floats" : [1.0 , 2.0 , 3.0 , 4.0 ],
1930+ "decimals" : [Decimal ((0 , (1 , 9 , 9 ), - 2 )), Decimal ((0 , (1 , 9 , 9 ), - 2 )), Decimal ((0 , (1 , 9 , 0 ), - 2 )), Decimal ((0 , (3 , 1 , 2 ), - 2 ))]
19291931 })
19301932
1931- path = f"s3://{ bucket } /test_aurora_postgres_slash "
1933+ path = f"s3://{ bucket } /test_aurora_postgres_special "
19321934 wr .pandas .to_aurora (dataframe = df ,
19331935 connection = "aws-data-wrangler-postgres" ,
19341936 schema = "public" ,
@@ -1958,14 +1960,25 @@ def test_aurora_postgres_load_special(bucket, postgres_parameters):
19581960 assert rows [1 ][2 ] == "\" "
19591961 assert rows [2 ][2 ] == "\\ \\ \\ \\ "
19601962 assert rows [3 ][2 ] == "\" \" \" \" "
1963+ assert (rows [0 ][3 ] == 1.0 ) and (str (type (rows [0 ][3 ])) == str (type (1.0 )))
1964+ assert rows [1 ][3 ] == 2.0
1965+ assert rows [2 ][3 ] == 3.0
1966+ assert rows [3 ][3 ] == 4.0
1967+ assert rows [0 ][4 ] == Decimal ((0 , (1 , 9 , 9 ), - 2 ))
1968+ assert rows [1 ][4 ] == Decimal ((0 , (1 , 9 , 9 ), - 2 ))
1969+ assert rows [2 ][4 ] == Decimal ((0 , (1 , 9 , 0 ), - 2 ))
1970+ assert rows [3 ][4 ] == Decimal ((0 , (3 , 1 , 2 ), - 2 ))
19611971 conn .close ()
19621972
19631973
19641974def test_aurora_mysql_load_special (bucket , mysql_parameters ):
19651975 df = pd .DataFrame ({
19661976 "id" : [1 , 2 , 3 , 4 ],
19671977 "value" : ["foo" , "boo" , "bar" , "abc" ],
1968- "special" : ["\\ " , "\" " , "\\ \\ \\ \\ " , "\" \" \" \" " ]
1978+ "slashes" : ["\\ " , "\" " , "\\ \\ \\ \\ " , "\" \" \" \" " ],
1979+ "floats" : [1.0 , 2.0 , 3.0 , 4.0 ],
1980+ "decimals" : [Decimal ((0 , (1 , 9 , 9 ), - 2 )), Decimal ((0 , (1 , 9 , 9 ), - 2 )), Decimal ((0 , (1 , 9 , 0 ), - 2 )),
1981+ Decimal ((0 , (3 , 1 , 2 ), - 2 ))]
19691982 })
19701983
19711984 path = f"s3://{ bucket } /test_aurora_mysql_special"
@@ -1998,6 +2011,14 @@ def test_aurora_mysql_load_special(bucket, mysql_parameters):
19982011 assert rows [1 ][2 ] == "\" "
19992012 assert rows [2 ][2 ] == "\\ \\ \\ \\ "
20002013 assert rows [3 ][2 ] == "\" \" \" \" "
2014+ assert (rows [0 ][3 ] == 1.0 ) and (str (type (rows [0 ][3 ])) == str (type (1.0 )))
2015+ assert rows [1 ][3 ] == 2.0
2016+ assert rows [2 ][3 ] == 3.0
2017+ assert rows [3 ][3 ] == 4.0
2018+ assert rows [0 ][4 ] == Decimal ((0 , (1 , 9 , 9 ), - 2 ))
2019+ assert rows [1 ][4 ] == Decimal ((0 , (1 , 9 , 9 ), - 2 ))
2020+ assert rows [2 ][4 ] == Decimal ((0 , (1 , 9 , 0 ), - 2 ))
2021+ assert rows [3 ][4 ] == Decimal ((0 , (3 , 1 , 2 ), - 2 ))
20012022 conn .close ()
20022023
20032024
0 commit comments