Skip to main content

How can I do partitioned writes by year and month on S3?

Learn how to write partitioned data by year and month to an S3 bucket in ClickHouse, using a custom path structure for organizing the data.

Learn how to do partitioned writes by year and month on S3

I want to export data segregating the path in S3 bucket to follow a structure like:

  • 2022
    • 1
    • 2
    • ...
    • 12
  • 2021
    • 1
    • 2
    • ...
    • 12

and so on ...

Answer

Considering the ClickHouse table:

Add 10000 entries:

Run this to create the desired structure in s3 bucket my_bucket (note this example writes files in parquet format):

· One min read