@@ -1103,12 +1103,12 @@ def copy( # pylint: disable=too-many-arguments
11031103) -> None :
11041104 """Load Pandas DataFrame as a Table on Amazon Redshift using parquet files on S3 as stage.
11051105
1106- This is a **HIGH** latency and **HIGH** throughput alternative to `wr.db .to_sql()` to load large
1106+ This is a **HIGH** latency and **HIGH** throughput alternative to `wr.redshift .to_sql()` to load large
11071107 DataFrames into Amazon Redshift through the ** SQL COPY command**.
11081108
11091109 This strategy has more overhead and requires more IAM privileges
1110- than the regular `wr.db .to_sql()` function, so it is only recommended
1111- to inserting +1MM rows at once.
1110+ than the regular `wr.redshift .to_sql()` function, so it is only recommended
1111+ to inserting +1K rows at once.
11121112
11131113 https://docs.aws.amazon.com/redshift/latest/dg/r_COPY.html
11141114
@@ -1129,7 +1129,8 @@ def copy( # pylint: disable=too-many-arguments
11291129 df: pandas.DataFrame
11301130 Pandas DataFrame.
11311131 path : str
1132- S3 path to write stage files (e.g. s3://bucket_name/any_name/)
1132+ S3 path to write stage files (e.g. s3://bucket_name/any_name/).
1133+ Note: This path must be empty.
11331134 con : redshift_connector.Connection
11341135 Use redshift_connector.connect() to use "
11351136 "credentials directly or wr.redshift.connect() to fetch it from the Glue Catalog.
@@ -1204,6 +1205,11 @@ def copy( # pylint: disable=too-many-arguments
12041205 path = path [:- 1 ] if path .endswith ("*" ) else path
12051206 path = path if path .endswith ("/" ) else f"{ path } /"
12061207 session : boto3 .Session = _utils .ensure_session (session = boto3_session )
1208+ if s3 .list_objects (path = path ):
1209+ raise exceptions .InvalidArgument (
1210+ f"The received S3 path ({ path } ) is not empty. "
1211+ "Please, provide a different path or use wr.s3.delete_objects() to clean up the current one."
1212+ )
12071213 s3 .to_parquet (
12081214 df = df ,
12091215 path = path ,
0 commit comments