When using wr.s3.to_parquet
I can construct a path with a Formatted string literal and have existing folders using the pattern.
def SaveInS3_test(Ticker, Granularity, Bucket, df, keyPrefix=""):
year, month, day = datetime.utcnow().strftime("%Y/%m/%d/%H").split("/")[0:3]
path = (
f"s3://{Bucket}/{keyPrefix}{year}/{month}/{day}/{Ticker}/{Granularity}.parquet"
)
print(path)
wr.s3.to_parquet(df, path, index=True, dataset=True, mode="append")
df=pd.DataFrame({'col': [1, 2, 3]})
SaveInS3_test("GBP", "H1","my_bucket", df, keyPrefix="Test/")
The path would then be something like this:
s3://my_bucket/Test/2022/08/06/GBP/H1.parquet
I would like to use the Athena/Glue database functionality of wrangler as follows (this works):
wr.s3.to_parquet(
df=df,
path=f's3://my_bucket',
dataset=True,
database='default', # Athena/Glue database
table='my_table') # Athena/Glue table
Can I use my F-string approach to path structure in some way with this database functionality?:
s3://my_bucket/Test/2022/08/06/GBP/H1.parquet
I'm not sure how I would use partitions or similar to do this.
Any attempts I make to use a path return an InvalidArgumentValue
as it does not match the existing Glue catalog table path.