Using a weighted list in place of a FK.

Sometimes my FK is just a numbered list in a reference table.  I wish sometimes to replace the FK with a weighted list so that it will be more realistic.  It seems like sometimes the weighted list doesn't work, I end up with equal values of the FK instead of the weighted list.  Additional:  often when I am filling out the generator options for a column, every time I change an option, I have to wait for the generator to run and come back to allow me to make another change.  Is there any way that I can change all my column generator options and then have the generator run?

Best Answer

  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Thanks @Mij! :)



    Using these settings appear to work alright from a quick test, as the generated rows end up with about 70% of 1s and 30% of 2s. I think the percentage may likely look off because the preview is only showing the top 200 rows.

    If you increase the amount shown in the preview, does it look more like a 70/30 split? (The preview can only show up to 1000 rows though, I'm afraid.)

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Answers

  • Jessica RJessica R Posts: 1,319 Rose Gold 4

    Hi @Mij!

    You can stop the generator from running immediately by going to Edit Project>Options and unticking 'Auto generate previews'. (Then after each change, you'll be prompted to click the preview area before it will re-generate the preview.)

    Regarding the weighted generator giving equal weight to the values, I'd like to try to reproduce this locally. Can you kindly let us know more detail like the column type, and the weight ratios used?

    Thank you!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • MijMij Posts: 23 Bronze 1
    Hi, my column is int, not null.  The only values are 1 and 2.  I tried to put 70% 1 and 30% 2, but the initial generation preview shows about equal amounts of each value.  The seed is 11269.  I have attached the image of the weighted list preview.
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Thanks @Mij! And can I just double check a few more things:

    - What version of SQL Data Generator you are using?
    - How many rows are you generating?
    - How many rows are shown in the preview? (Tools>Application options>General>Number of rows in generator preview)

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • MijMij Posts: 23 Bronze 1
    SQL Data Generator 4.  2000 rows are being generated, 100 rows are in the preview, though only 20 show at the top screenshot.
Sign In or Register to comment.