fetchall returning hex characters?
Posted: Wed May 07, 2014 10:58 pm
I am trying to figure out how to connect to Vertica with pyODBC and am having some problems with the returned rows just being garbage.
Using:
Vertica 7.0
Python 2.4.3
pyODBC 2.1.6
From vsql:
From a short python program:
[dbadmin@vertica1 dan]$ ./t
(u'\x00\U00650074\U00740073\U006e005f\U0064006f\U00300065\U00300030', u'\x00')
(u'\x00\U00650074\U00740073\U006e005f\U0064006f\U00300065\U00300030', u'\x00')
(u'\x00\U00650074\U00740073\U006e005f\U0064006f\U00300065\U00300030', u'\x00')
Is there any way to make the output "usable"? Some setting I have not set?
my odbc.ini file:
[dbadmin@vertica1 dan]$ cat /etc/odbc.ini
[vertica]
Driver = /opt/vertica/lib64/libverticaodbc.so
Servername = 10.100.xxxx.xxx
Database = Test
Port = 5433
UserName = dbadmin
Password = xxxxxxx
my vertica.ini file
[dbadmin@vertica1 dan]$ cat /etc/vertica.ini
[Driver]
DriverManagerEncoding=UTF-16
ODBCInstLib=/usr/lib64/libodbcinst.so
ErrorMessagesPath=/opt/vertica/lib64
LogLevel=4
LogPath=/tmp
Using:
Vertica 7.0
Python 2.4.3
pyODBC 2.1.6
From vsql:
Code: Select all
[dbadmin@vertica1 dan]$ vsql -c "select node_name, node_state from v_internal.vs_node_states"
node_name | node_state
-----------------+------------
v_test_node0004 | UP
v_test_node0005 | UP
v_test_node0006 | UP
From a short python program:
Code: Select all
#!/usr/bin/env python
import pyodbc
cnxn = pyodbc.connect("DSN=vertica",ansi=True)
cursor = cnxn.cursor()
cursor.execute("select * from test")
rows = cursor.fetchall()
for row in rows:
print row
(u'\x00\U00650074\U00740073\U006e005f\U0064006f\U00300065\U00300030', u'\x00')
(u'\x00\U00650074\U00740073\U006e005f\U0064006f\U00300065\U00300030', u'\x00')
(u'\x00\U00650074\U00740073\U006e005f\U0064006f\U00300065\U00300030', u'\x00')
Is there any way to make the output "usable"? Some setting I have not set?
my odbc.ini file:
[dbadmin@vertica1 dan]$ cat /etc/odbc.ini
[vertica]
Driver = /opt/vertica/lib64/libverticaodbc.so
Servername = 10.100.xxxx.xxx
Database = Test
Port = 5433
UserName = dbadmin
Password = xxxxxxx
my vertica.ini file
[dbadmin@vertica1 dan]$ cat /etc/vertica.ini
[Driver]
DriverManagerEncoding=UTF-16
ODBCInstLib=/usr/lib64/libodbcinst.so
ErrorMessagesPath=/opt/vertica/lib64
LogLevel=4
LogPath=/tmp