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

Python script error

dmilovdmilov Posts: 2
edited March 14, 2016 12:53PM in SQL Data Generator
I have single table to populate with random data. One of fields is dependent on the other one. To be more precise when the value of the first field is H, I need to have random number between 10 and 250 in the second field, and when the value in the first field is S, the value in the second field should be between 10,000 and 250,000. I have created Python script to generate this random numbers.
In case of generating 10,000 or fewer records, everything works fine; but, in case of larger number of records (50K +), the script fails.

It looks as memory error to me. What do you guys think?

Error message:
The value " cannot be inserted into column EMP SALARY
RedGate.SQLDataGeneratorEngineDataGeneration.InvaIidCoIumnDataException: The value ' cannot be inserted
into column EMP SALARY at
RedGate.SQLDataGeneratorEngineDataGeneration.TypeTransIationDataReader.Read) at
SystemData.SqICIient.SqIBuIkCopyReadFromRowSource() ...

# Basic generator template
import clr
from System import Random
random = Random();

def main(config):
if EMP_TYPE_CODE == 'H': out = random.Next(10, 200)
elif EMP_TYPE_CODE == 'S': out = random.Next(10000, 200000)
else: out = 10
return out


Sign In or Register to comment.