Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement mode == "overwrite" in to_deltalake #34

Open
j-bennet opened this issue Jul 6, 2023 · 0 comments
Open

Implement mode == "overwrite" in to_deltalake #34

j-bennet opened this issue Jul 6, 2023 · 0 comments

Comments

@j-bennet
Copy link
Collaborator

j-bennet commented Jul 6, 2023

The first version of writing into deltalake did not implement overwriting an existing table. Currently, this is raising a ValueError (should actually raise a NotImplementedError):

import pandas as pd
import numpy as np
import dask.dataframe as dd
from dask_deltatable.write import to_deltalake


if __name__ == "__main__":
    df = pd.DataFrame({
        "i1": np.random.randint(1, 10000, size=100),
        "f1": np.random.random(100),
        "s1": np.random.choice(["Apple", "Banana", "Watermelon", "Mango"], size=100),
    })
    ddf = dd.from_pandas(df, npartitions=10)
    to_deltalake("t1_data", ddf, mode="overwrite").compute()

Raises:

Traceback (most recent call last):
  File "/Users/jbennet/src/dask-deltatable/t1.py", line 14, in <module>
    to_deltalake("t1_data", ddf, mode="overwrite").compute()
  File "/Users/jbennet/src/dask-deltatable/dask_deltatable/write.py", line 82, in to_deltalake
    raise ValueError(
ValueError: Schema of data does not match table schema
Table schema:
None
Data Schema:
i1: int64
f1: double
s1: string

Original PR: #29.

@j-bennet j-bennet mentioned this issue Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant