dropbox / dropbox/PyHive

Unicode characters are not supported in Presto cursors

Open
#350 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
545
PR merge metrics
No merged PRs in 30d

Description

Hello,

It seems Unicode characters are not supported in cursors. When a Presto table has Unicode characters, UnicodeEncodeError error comes up during retrieval of cursor values. cp1252 encoding is applied. Is there any setting to apply utf-8 encoding?

**Error message**
```
Traceback (most recent call last):
File "C:\\Code\prestodb_stats.py", line 146, in
print(field)
File "C:\Program Files\Python36\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\uffe5' in position 0: character maps to

```

**Code**
```python
conn = presto.connect(**con_config)
cur = conn.cursor()
cur.execute(sql_text)
rows = cur.fetchall()

for row in rows:
for field in row:
print(field)
```

For example, Unicode value is **¥**.

Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.