import pyodbc
def initialize_odbc():
cnxn = pyodbc.connect('Driver={Amazon Redshift (x64)}; Server=xxxx; Database=name; UID=ldocao; PWD=myspaswd; Port=1111')
return cnxn
def create_test_table(cursor):
try:
cursor.execute('drop table test_table')
except:
pass
cursor.execute("CREATE TABLE test (name varchar(10))")
cursor.commit()
connection = initialize_odbc()
cursor = connection.cursor()
create_test_table(cursor)
This raises an Error:
7 except:
8 pass
----> 9 cursor.execute("CREATE TABLE test (name varchar(10))")
10 cursor.commit()
11
Error: ('HY000', '[HY000] [Amazon][RedShift ODBC] (30) Error occurred while trying to execute a query: ERROR: Only ASCII characters are allowed in an identifier.Invalid ASCII char: ef bf bd \n (30) (SQLExecDirectW)')
Python 3.5.0
Linux version 4.1.10-17.31.amzn1.x86_64 (mockbuild@gobi-build-60008) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) on EC2
pyodbc==3.0.10