datahelix icon indicating copy to clipboard operation
datahelix copied to clipboard

How could the generator be used to generate relational data?

Open ColinEberhardt opened this issue 6 years ago • 3 comments

If we take a simple one-to-many relationship...

A database that has a department table, with DeptNo as a primary key

DeptNo DeptName
10 Marketing
20 Purchasing

And an employee table, where each employee has a department:

EmpNo EName DeptNo
101 Abigail 10
102 Bob 20
103 Carolyn 10
104 Doug 20
105 Evelyn 10

How could we generate this data?

ColinEberhardt avatar Apr 02 '19 05:04 ColinEberhardt

We could perhaps generate each table using a different profile. In the example above we could generate the 'department' table:

Q. How would we ensure that the DeptNo field is unique? Would this constrain us to using a full sequential generation mode and a range constraint? Could we perhaps add a 'unique' constraint?

Once the department table is generated, we could then generate the employee table. If a full sequential generation were used for department, then I guess we'd just have to apply the same range constraints for the DeptNo in the employee table?

ColinEberhardt avatar Apr 02 '19 07:04 ColinEberhardt

  • could be different profiles
  • could be flattened/denormalised and for the user to normalise for use
  • also describes unique keys (e.g. EmpNo) but not the primary requirement

sl-slaing avatar Apr 04 '19 11:04 sl-slaing

currently our data generator only generates rows of data.

one option is to have a relational generator, that calls onto our rowGenerator for each table, and combines the results

pdaulbyscottlogic avatar Apr 10 '19 17:04 pdaulbyscottlogic