I am looking for a way to write back to a delta table in python without using pyspark. I know there is a library called deltalake/ delta-lake-reader that can be used to read delta tables and convert them to pandas dataframes.
The goal is to write back to the opened delta table
The input code looks like this:
from deltalake import DeltaTable
dt = DeltaTable('path/file')
df = dt.to_pandas()
So is there any way to get something like this to write from a pandas dataframe back to a delta table:
df = pandadf.to_delta()
DeltaTable.write(df, 'path/file')
Thank you for your assistance!
Now it is supported !!!, see this example
from pickle import TRUE
import duckdb
from deltalake.writer import write_deltalake
con = duckdb.connect()
df =con.execute('''
LOAD 'httpfs';
SELECT countries_and_territories, sum(deaths) as total FROM
read_parquet('https://pandemicdatalake.blob.core.windows.net/public/curated/covid-19/ecdc_cases/latest/ecdc_cases.parquet')
group by 1
order by total desc
limit 5;
''').fetchdf()
write_deltalake('Pathto/covid', df,mode='append')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.