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

Generic Python Issues with Simple Expressions and IronPython scripts involving dates and random

I have SQL Data Generator v4.5 installed (licensed and up-to-date) and I cannot get some very basic Simple Expressions or basic IronPython scripts to work  - some of the sample ones provided by the app give the same issues.  The following simple expression...

"Fred" if OffenderId < 10 else "Jim"

...gives "An error occurred.  Python error at line: 52: NameError: name 'datetime' is not defined

The expression has nothing to do with dates and the error isn't coming from a different column as if I just change the expression to "Fred", the table populates as expected.

I have installed various versions of Python and set them in the Application Options (Python 26, 27, 39, 310), all of which give the same error.

As for IronPython scripts, the supplied sample "First Name from Title" gives me a good starting point for my needs, but that gives errors around the random function, different versions of Python giving different errors:
26 & 27: Python error at line: 321: SyntaxError
39: Python error at line: 25: NameError: name 'random' is not defined
310: Python error at line: 64: AttributeError: 'str' object has no attribute 'isascii'

In addition to these issues, Logging doesn't work - if I enable it and then "Locate log files" it just fires up Windows Explorer at the root of the system.  Help -> Documentation loads a page "Server Error in '/help' Application."

I would appreciate some assistance on how I get this application working properly out-of-the-box and the samples that are provided working as expected.
Tagged:

Answers

  • Options
    Thank you for your post. For the benefit of others who may be experiencing the same as you, SQL Data Generator does not formally/well support the Python Randon function.

    There are several outstanding issues dating back to 2014 with no clear roadmap for fixes/development. 
    Kind regards

    Robyn Edwards | Redgate Software
    Have you visited our Help Center?
Sign In or Register to comment.