What are the challenges you face when working across database platforms? Take the survey
Options

Generating MD5

kfrancis25kfrancis25 Posts: 6 Bronze 1
edited May 27, 2014 7:14AM in SQL Data Generator
Is it possible to generate an MD5 hash of another column? It looks like I could use something like:
import hashlib
hashlib.md5("row column value".encode('utf-8')).hexdigest()

Comments

  • Options
    Hi- you mean with the python custom generator option? Sure, I think this will work.
  • Options
    kfrancis25kfrancis25 Posts: 6 Bronze 1
    It doesn't seem to work using the "Python script" generator, I just get errors about hashlib:
    An error occurred. ImportError: No module named hashlib - No installed python version was automatically detected; consider installing python 2.7 or adjusting the application options.
    IronPython documentation also shows the example:
    import md5
    m = md5.new()
    
    But I get the same type of error, just a different name:
    An error occurred. ImportError: No module named md5 - No installed python version was automatically detected; consider installing python 2.7 or adjusting the application options.
  • Options
    I see. Sorry about this. This looks like a current limitation of our support-I'll try to find out more. please bear with me...
  • Options
    This works:

    prepend file with:

    import sys

    sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
Sign In or Register to comment.