-
Hi, thanks for the project. I am exploring the python sdk, want to check any example on how to efficiently download files from s3 to local like boto3. currently I am trying is: # Read the file from the S3 bucket
file_content = op.read("test.txt")
# Print the file content to verify
print(file_content)
# write file to local
with open("test.txt", "wb") as f:
f.write(file_content) |
Beta Was this translation helpful? Give feedback.
Answered by
Xuanwo
Oct 18, 2024
Replies: 1 comment
-
Hi, please try read like a file: import opendal
import polars as pl
# Init an operator.
op = opendal.Operator("fs", root="/tmp")
# Create a DataFrame.
df = pl.DataFrame({"name": ["Alice", "Bob"], "age": [20, 30]})
print(f"df: {df}")
# Open and write the DataFrame to the file.
with op.open("test.csv", mode="wb") as file:
df.write_csv(file)
# Open and read the DataFrame from the file.
with op.open("test.csv", mode="rb") as file:
read_df = pl.read_csv(file)
print(f"read_df: {read_df}") |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Xuanwo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, please try read like a file: