pymssql - handle guid column value


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # final solution for pymssql guid col value
  2. import uuid
  3. # ...
  4. x = uuid.UUID( bytes=rs[0][1] )
  5. print x
  6. >>> print x
  7. >>> 524b585b-c827-db44-9d14-2dd72b6190fc
  8.  
  9. # using pywintypes
  10. import pywintypes
  11. uv =pywintypes.IID( rs[0][1], True )
  12.  
  13.  
  14. also from test code in my Python25 install
  15. s = "{00020400-0000-0000-C000-000000000046}"
  16. iid = pywintypes.IID(s)
  17. iid2 = pywintypes.IID(buffer(iid), True)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.