question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

redshift_connector Driver throws error while running SELECT 1 (or any query)

See original GitHub issue

A clear and concise description of what the bug is. We were using driver redshift+psycopg2 , that worked well so far. As part of enhanced security we moved from that driver to redshift+redshift_connector driver. Although it does successful connect & dropdown of tables. it is unable to display correct dataset & getting mentioned error below:

How to reproduce the bug

  1. install redshift_connector bootstrapScript: | #!/bin/bash rm -rf /var/lib/apt/lists/* &&
    pip install
    psycopg2-binary==2.9.1
    redis==3.5.3
    sqlalchemy-redshift==0.8.9
    redshift-connector==2.0.907 &&
    if [ ! -f ~/bootstrap ]; then echo “Running Superset with uid {{ .Values.runAsUser }}” > ~/bootstrap; fi

  2. Go to ‘databases’ => Add database using username / password or IAM based. test connect

  3. Go to sql editor page

  4. select database & relevant schema.

  5. On editor type “SELECT 1”

  6. See below error: First element of field tuple is neither a tuple nor str

Expected results

Output with data 1 what you expected to happen.

Actual results

what actually happens. On pod we are getting below error trace: raceback (most recent call last): File “/app/superset/views/base.py”, line 207, in wraps return f(self, *args, **kwargs) File “/app/superset/utils/log.py”, line 245, in wrapper value = f(*args, **kwargs) File “/app/superset/views/core.py”, line 2393, in sql_json command_result: CommandResult = command.run() File “/app/superset/sqllab/command.py”, line 104, in run raise ex File “/app/superset/sqllab/command.py”, line 96, in run status = self._run_sql_json_exec_from_scratch() File “/app/superset/sqllab/command.py”, line 138, in _run_sql_json_exec_from_scratch raise ex File “/app/superset/sqllab/command.py”, line 133, in _run_sql_json_exec_from_scratch return self._sql_json_executor.execute( File “/app/superset/sqllab/sql_json_executer.py”, line 111, in execute raise SupersetErrorsException( superset.exceptions.SupersetErrorsException: [SupersetError(message=‘First element of field tuple is neither a tuple nor str’, error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: ‘GENERIC_DB_ENGINE_ERROR’>, level=<ErrorLevel.ERROR: ‘error’>, extra={‘engine_name’: ‘Amazon Redshift’, ‘issue_codes’: [{‘code’: 1002, ‘message’: ‘Issue 1002 - The database returned an unexpected error.’}]})]

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

(please complete the following information):

  • browser type and version: chrome:
  • superset version: superset version: Superset 0.0.0dev
  • python version: python --version: Python 3.8.12
  • node.js version: node -v:
  • any feature flags active: [ installed with helm chart ] helm install superset . --values=values.yaml -n superset-experiment

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

Add any other context about the problem here. Few more details about debug trace from redshift_connector can be seen as below: 2022-05-17 05:50:12,363:DEBUG:redshift_connector:=================================== 2022-05-17 05:50:12,363:DEBUG:redshift_connector.cursor:Cursor.paramstyle=named 2022-05-17 05:50:12,363:DEBUG:redshift_connector.core:=================================== 2022-05-17 05:50:12,363:DEBUG:redshift_connector.core:Establishing a connection 2022-05-17 05:50:12,363:DEBUG:redshift_connector.core:{‘user’: ‘IAM:uksegmentexplorer’, ‘database’: ‘dev’, ‘application_name’: ‘sqlalchemy-redshift’, ‘replication’: None, ‘client_protocol_version’: ‘2’, ‘driver_version’: ‘Redshift Python Driver 2.0.907’, ‘os_version’: ‘Linux-5.4.181-99.354.amzn2.x86_64-x86_64-with-glibc2.2.5’} 2022-05-17 05:50:12,363:DEBUG:redshift_connector.core:=================================== 2022-05-17 05:50:12,369:DEBUG:redshift_connector.cursor:Cursor.paramstyle=format 2022-05-17 05:50:12,369:DEBUG:redshift_connector.core:Sending start-up message 2022-05-17 05:50:12,551:DEBUG:redshift_connector.core:Server indicated EXTENDED_RESULT_METADATA transfer protocol will be used rather than protocol requested by client: BINARY 2022-05-17 05:50:12,551:DEBUG:redshift_connector.cursor:Cursor.paramstyle=format 2022-05-17 05:50:12,559:DEBUG:redshift_connector.core:field count=1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
eschuthocommented, Jun 24, 2022

I’m going to close this ticket given @betodealmeida’s fix, but feel free to comment if you feel that action was premature.

0reactions
Brooke-whitecommented, Jun 14, 2022

Thanks for the heads up @betodealmeida – we are working with @niravpeak to determine what a migration path looks like for retrieving column names as strings

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Amazon Redshift connection errors
1. Open the Amazon Redshift console. 2. Choose the Config tab. 3. Modify the parameter group that's associated with your Amazon Redshift cluster ......
Read more >
redshift-connector - PyPI
redshift_connector is the Amazon Redshift connector for Python. Easy integration with pandas and numpy, as well as support for numerous Amazon Redshift ...
Read more >
Setting Up Python Redshift Connection: 3 Easy Methods - Learn
In this article, you will see how you can establish a Python Redshift connection to access and query Amazon Redshift data.
Read more >
Connecting to Amazon Redshift? - Tableau Community
I get a Database error 0x80004005: Unspecified error, error while executing the query. Unable to connect to the server.
Read more >
Getting Started with the Amazon Redshift Connector
Amazon Redshift Connector enables you to connect to an Amazon Redshift database cluster setup via Amazon Redshift JDBC driver.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found