SELECT query directly to an Amazon S3 location using COPY TO. This method is more flexible and efficient than downloading query results manually from the Firebolt Workspace, making it ideal for data sharing, integration, and archival.
How to export data
The following code example usesCOPY TO to export the result of a SELECT query from my_table to a specified Amazon S3 bucket in CSV format using the provided AWS credentials:
Choose the right export format
Examples
Export data in CSV format Use CSV when you need a simple, widely supported format for spreadsheets, relational databases, or data exchange. The following code example exportsuser_id, event_type, and timestamp data and headers from the user_events table to a CSV file in an Amazon S3 bucket:
sales_data table to an Amazon S3 bucket in Parquet format using the provided AWS credentials:
order_id and order_details from the orders table to an Amazon S3 bucket in JSON format using the provided AWS credentials:
name, age, and city from the customers table to an Amazon S3 bucket in TSV format using the provided AWS credentials:
Additional Considerations
Performance tips- Export only required columns and use filters to reduce data volume
- Ensure proper permissions are set on your S3 bucket
- Always use secure AWS credentials.
- Use IAM roles instead setting credentials directly in the code for better security.