【问题标题】:How can I bucketing with s3 using aws glue?如何使用 aws 胶水使用 s3 进行存储?
【发布时间】:2020-02-18 07:28:09
【问题描述】:

我尝试在 S3 上使用 AWS Glue 进行分区和分桶。但是分桶没有奏效。只有分区确实有效。如何使用 AWS Glue 进行存储桶?

datasink4 = glueContext.write_dynamic_frame.from_options(
    frame = dropnullfields3,
    connection_type = "s3",
    connection_options = {"path": s3_output_full,
                          "partitionKeys": ["PARTITIONKEY"],
                          "bucketColumns": ["ROW_ID"],
                          "numberOfBuckets": 12},
    format = "parquet",
    transformation_ctx = "datasink4")

job.commit()

【问题讨论】:

    标签: python amazon-web-services aws-glue bucket


    【解决方案1】:

    我认为它们尚不受支持

    我的脚本改用了 bucketBy 函数;但它会替换定义路径中的现有数据

    df_name, job_df = (str(transform_name), df)
    datasink_path = "s3://sink-bucket/job-data/"
    writing = job_df.write.format('parquet').mode("append") \
                              .partitionBy('event_day') \
                              .bucketBy(3, 'bucketed_field') \
                              .saveAsTable(df_name, path = datasink_path)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-31
      • 1970-01-01
      • 2020-06-19
      • 1970-01-01
      • 2021-10-14
      • 2023-03-20
      • 1970-01-01
      相关资源
      最近更新 更多