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

fix: results containing \u0000 break run_query_dataframe #133

Open
gosuto-inzasheru opened this issue Jul 19, 2024 · 0 comments
Open

fix: results containing \u0000 break run_query_dataframe #133

gosuto-inzasheru opened this issue Jul 19, 2024 · 0 comments

Comments

@gosuto-inzasheru
Copy link
Contributor

pandas' read_csv does not properly read the string if it contains these unicodes and the string is discarded instead

it either should be stripped on dune side or maybe there is a cleaner way than my current hacky workaround:

raw = dune.run_query_csv(query).data
with open('dirty.tmp', 'wb') as f:
    f.write(raw.getbuffer())
with open('clean.tmp', 'w') as f:
    buffer = open('dirty.tmp').read()
    for sanitise in ['\x00', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f']:
        buffer = buffer.replace(sanitise, '')
    f.write(buffer)
df = pd.read_csv('clean.tmp')

for clarity, the data point in question is a result of

FROM_UTF8(VARBINARY_LTRIM (data))
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