redash icon indicating copy to clipboard operation
redash copied to clipboard

Error running query: 'ascii' codec can't encode characters in position

Open artemsafiyulin opened this issue 1 year ago • 3 comments

Issue Summary

I am getting an error on running queries.

Error running query: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128

Steps to Reproduce

  1. Setup redash version 10.1.0 (2589bef1)
  2. Add postgresql datasource
  3. In postgresql create database with SQL_ASCII encoding and create table with row containing 'ç'
  4. In redash create query wich will select this row from postgresql or without tabe just query: "select 'ç' "

If we change database encoding to utf8 and run query again - we don't get error.

Technical details:

  • Redash Version: 10.1.0 (2589bef1)
  • Browser/OS: chrome/centos7
  • How did you install Redash: docker-compose

I tried apply this fix to our installation: https://github.com/getredash/redash/pull/2165 But it doesn't help.

artemsafiyulin avatar Feb 20 '24 10:02 artemsafiyulin

I add the following code in the /app/redash/task/queries.py file and it works fine

import sys reload(sys) sys.setdefaultencode("utf8")

image @artemsafiyulin , Hope this helps you

annisun2020 avatar Mar 18 '24 07:03 annisun2020

@annisun2020 I can't find this path in redash project. Can you send link on file in repo which you chnge?

artemsafiyulin avatar Mar 18 '24 10:03 artemsafiyulin

@annisun2020 I can't find this path in redash project. Can you send link on file in repo which you chnge? docker exec -it redash-adhoc_worker-1 /bin/bash vim /app/redash/tasks/queries.py

annisun2020 avatar Mar 21 '24 08:03 annisun2020