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

SQL Compilation Error on UPDATE #251

Closed
cedricwebisoft opened this issue Dec 17, 2019 · 2 comments
Closed

SQL Compilation Error on UPDATE #251

cedricwebisoft opened this issue Dec 17, 2019 · 2 comments
Labels

Comments

@cedricwebisoft
Copy link

cedricwebisoft commented Dec 17, 2019

I have an error on a simple update if I update more than one field. If I update only one field, no problems. Code to reproduce and the error is below:

version: snowflake-connector-python-2.1.2

#!/usr/bin/env python

""" test script to be sure connection with snowflake worked """
import json

import snowflake.connector

snowflake.connector.paramstyle = 'qmark'  # prepared statement use `?`
credentials = {
    'user': 'my_user',
    'password': 'my_password',
    'account': 'my_account',
    'warehouse': 'my_warehouse',
    'database': 'my_db',
}

ctx = snowflake.connector.connect(**credentials)
cs = ctx.cursor(snowflake.connector.DictCursor)
try:
    cs.execute("UPDATE objective_source SET objective_id = 3, source_type_id = 3 WHERE id = 3 ")
finally:
    cs.close()
ctx.close()

Traceback (most recent call last):
  File "snowflake_connector.py", line 20, in <module>
    cs.execute("UPDATE objective_source SET objective_id = 3 AND source_type_id = 3 WHERE id = 3 ")
  File "/home/vagrant/.venv/lib/python3.6/site-packages/snowflake/connector/cursor.py", line 597, in execute
    errvalue)
  File "/home/vagrant/.venv/lib/python3.6/site-packages/snowflake/connector/errors.py", line 97, in errorhandler_wrapper
    cursor.errorhandler(connection, cursor, errorclass, errorvalue)
  File "/home/vagrant/.venv/lib/python3.6/site-packages/snowflake/connector/errors.py", line 73, in default_errorhandler
    done_format_msg=errorvalue.get(u'done_format_msg'))
snowflake.connector.errors.ProgrammingError: 002023 (22000): SQL compilation error:
Expression type does not match column data type, expecting NUMBER(38,0) but got BOOLEAN for column OBJECTIVE_ID
@howryu
Copy link
Contributor

howryu commented Dec 17, 2019

This seems to be SQL bug. Can you successfully run the command through UI? What is the query ID?

@sfc-gh-stakeda
Copy link
Contributor

Please reach out the customer support. This repository issue is for Python Connector specific ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants