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

[BUG]write_delta({'custom_metadata':str}) cannot be converted. str to pyDict error (0.18.2_DeltaPython/Windows10) #2697

Closed
7 tasks
starzar opened this issue Jul 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@starzar
Copy link

starzar commented Jul 15, 2024

Bug

0.18.2_DeltaPython/Windows10

  • Spark
  • [x ] Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Describe the problem

write_deltalake_pyarrow(TypeError: argument 'custom_metadata': 'str' object cannot be converted to 'PyDict'

Steps to reproduce

import polars as pl
import datetime
datetime_cur = datetime.datetime.now()
datetime_cur_str = datetime_cur.strftime("%Y-%m-%d")
data = {
    "timestamp": [datetime_cur, datetime_cur + datetime.timedelta(days=1)],
    "alphabet": ["A", "B"]
}

_df = pl.DataFrame(data)

print(_df)
print('datetime_cur_str')
print(type(datetime_cur_str))
print(datetime_cur_str)
_deltapath = r'Others/Polars/tests'

# error occurs for both engines : 'engine': 'pyarrow'/'rust'
_df.write_delta(target=_deltapath, mode="overwrite", overwrite_schema=False,
                            delta_write_options={'engine': 'pyarrow', 'custom_metadata': datetime_cur_str})

-->

Observed results

Traceback (most recent call last):
  File "C:\Users\User_0\Documents\Code\Python\NseScraping\Others\Polars\tests\deltalake1.py", line 20, in <module>
    _df.write_delta(target=_deltapath, mode="overwrite", overwrite_schema=False,
  File "C:\Users\User_0\AppData\Local\Programs\Python\Python312\Lib\site-packages\polars\dataframe\frame.py", line 3877, in write_delta
    write_deltalake(
  File "C:\Users\User_0\AppData\Local\Programs\Python\Python312\Lib\site-packages\deltalake\writer.py", line 543, in write_deltalake
    write_deltalake_pyarrow(
TypeError: argument 'custom_metadata': 'str' object cannot be converted to 'PyDict'

Expected results

Further details

Environment information

  • Delta Lake version:
  • Spark version:
  • Scala version:

Willingness to contribute

The Delta Lake Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the Delta Lake code base?

  • Yes. I can contribute a fix for this bug independently.
  • Yes. I would be willing to contribute a fix for this bug with guidance from the Delta Lake community.
  • No. I cannot contribute a bug fix at this time.
@starzar starzar added the bug Something isn't working label Jul 15, 2024
@MrPowers
Copy link
Collaborator

Thanks for opening this! Looks like this is for the delta-rs repo, going to transfer this issue now.

@MrPowers MrPowers transferred this issue from delta-io/delta Jul 22, 2024
@ion-elgreco
Copy link
Collaborator

ion-elgreco commented Jul 22, 2024

@starzar this isn't a bug. Custom metadata takes a dict[str,str] as value

@ion-elgreco ion-elgreco closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants