This is a series on SQL Data Generator, covering some interesting scenarios I’ve run into. If you’ve never tried it, SQL Data Generator is a part of the SQL Toolbelt. Give it a try today with an evaluation today.
I have SQL Data Generator, and use it regularly to build quick test data in non-trivial scenarios. One of the things I ran into recently was a minor bug, but one that’s been logged. Hopefully you won’t need this, but in case you do.
I was trying to use a Python script and return a random value from a list. My code was:
This gave me an error.
No biggie, I’ll add “import random” to the top of the script. That didn’t help. Apparently the distro with SQL Data Generator is missing the random module for some reason.
Fortunately, I have Python 2.7 on my system. I clicked “Tools” and “Application Options” in SQL Data Generator.
This gave me a dialog. On the General tab, there’s a “Python” section. I added the path to my Python lib folder in here.
That worked fine. I didn’t need to import random; it was available. My script now worked.