The easiest way to load data into Amazon Redshift is to use the COPY command. This command can load data from Amazon S3, DynamoDB, and EMR clusters. The COPY command has a few different syntaxes, so be sure to check the Amazon Redshift documentation to see which one will work best for your data.
If you're using boto3 to interact with Amazon Redshift, you can use the following code to run a COPY command:
import boto3
redshift = boto3.client('redshift')
copy_command = "COPY {table_name} FROM '{s3_path}' CREDENTIALS 'aws_iam_role={iam_role}';"
redshift.execute(copy_command)
Replace {table_name} with the name of the table you want to load data into, {s3_path} with the path to the data in S3, and {iam_role} with the IAM role that gives Amazon Redshift access to your data.
For more information on how to load data into Amazon Redshift, check out this blog post: https://aws.amazon.com/blogs/big-data/loading-data-into-redshift-from-s3/.