0

如何s3_config为 python spectrify 包指定这个对象?

from spectrify.export import RedshiftDataExporter
RedshiftDataExporter(sa_engine, s3_config).export_to_csv('my_table')
4

1 回答 1

1

spectrify 包的文档不是很好,但是快速阅读代码和示例会告诉您 s3_config 可以是 S3Config 或 SimpleS3Config 的实例,两者都由 spectrify 包定义。这是一个例子

csv_path_template = 's3://my-bucket/my-table/csv/{start.year}/{start.month:02d}/{start.day:02d}'
spectrum_path_template = 's3://my-bucket/my-table/spectrum/partition_key={start}'

# Construct a S3Config object with the source CSV folder and
# destination Spectrum/Parquet folder on S3.
csv_path = csv_path_template.format(start=start_date)
spectrum_path = spectrum_path_template.format(start=start_date)
s3_config = SimpleS3Config(csv_path, spectrum_path)
于 2019-02-02T14:52:20.257 回答