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

Output formatter corrupts original data #578

Closed
MaxKh opened this issue Feb 23, 2024 · 3 comments
Closed

Output formatter corrupts original data #578

MaxKh opened this issue Feb 23, 2024 · 3 comments

Comments

@MaxKh
Copy link

MaxKh commented Feb 23, 2024

version: 3.5.0
python 3.11

I'm trying to export the same dataset several times in different file formats. I've found that specifying a formatter for a column data alters the underlying data. The issue occurs if exporting the same format too.

import tablib

dataset = tablib.Dataset()
dataset.headers = ["text"]
dataset.append(["aAbBcC"])
dataset.add_formatter("text", lambda s: s[2:])

print(dataset.export("csv"))
print(dataset.export("csv"))

Output:

text
bBcC

text
cC
claudep added a commit to claudep/tablib that referenced this issue Feb 24, 2024
@claudep
Copy link
Contributor

claudep commented Feb 24, 2024

Thanks for the report! Do you want to test the above pull request?

@MaxKh
Copy link
Author

MaxKh commented Feb 24, 2024

I'll wait for a new release. Thanks

@hugovk
Copy link
Member

hugovk commented Feb 25, 2024

If you can test it, it would help us know if it really fixes it, means we can release sooner, and potentially avoid re-fixing later.

claudep added a commit to claudep/tablib that referenced this issue Feb 25, 2024
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

3 participants