hi,

in my table the field row_id is type of uniqueidentifier.

when try to fetch the data, pymssql somehow, encodes the values in a
way which yields odd results.

for example:
the value
'EE604EE3-4AB0-4EE7-AF4D-018124393CD7'
is represent as
'\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\xd7'

the only way I manged to pass this is by converting the value into
varchar at the server side.
I would like to solve this at the python side and not in the database
for several obvious reasons

see example:

>>> conn = mymssql.connect(**connection_details)
>>> cur = conn.cursor()
>>> sql = "select row_id, cast(row_id as varchar(36)) from table_a"
>>> cur.execute(sql)
>>> rows = cur.fetchall()
>>> rows[0]
('\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\xd7', 'EE604EE3-4AB0-4EE7-
AF4D-018124393CD7')
>>>
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to