---json { "description": "This how-to shows you how to generate random data with the column random generator.", "low_quality_page": "false", "page_id": "bi8ermzs2ogeyim4vvnxd", "title": "How to generate random data" } --- ====== Tabulify - How to generate random data ====== ===== About ===== This [[..:howto|how-to]] shows you how to generate ''random'' data with the [[docs:generator:random|column random generator]]. ===== Steps ===== ==== Creation of the generator file ==== To generate data, you need to create a [[docs:resource:generator|generator file]] that will describe the data to be generated. The below [[docs:resource:generator|data resource generator]]: * has the [[docs:resource:name|name]] ''random--datagen.yml'' * has the [[docs:resource:logicalname|logical name]] ''random'' * will generate ''30'' values (''MaxRecordCount'' count) * has a column named ''id'' that has [[docs:generator:sequence|sequence data generator]] that: * starts by default at the value ''1'' * increments by default with the value ''1'' * has a column for each data type with a [[docs:generator:random|random generator]] where the range is defined by: * a ''max'' * and a ''min'' MaxRecordCount: 30 Columns: - name: id type: integer comment: A id column to see easily the number of values generated DataGenerator: type: sequence - name: int type: integer comment: A column with a random integer generator DataGenerator: type: random min: 0 max: 5 - name: rand_float type: float comment: A column with a random float generator DataGenerator: type: random min: 0.0 max: 8.0 - name: rand_double type: double comment: A column with a random double generator DataGenerator: type: random min: 0.0 max: 8.0 - name: numeric type: numeric scale: 2 comment: A column with a random numeric generator with a scale of 2 DataGenerator: type: random min: 10.40 max: 19.50 - name: rand_date type: date comment: A column with a random date generator DataGenerator: type: random min: 2020-10-01 max: 2020-11-01 - name: rand_timestamp type: timestamp comment: A column with a random timestamp generator DataGenerator: type: random min: 2020-10-01 01:00:00 max: 2020-10-01 02:00:00 - name: rand_time type: time comment: A column with a random time generator DataGenerator: type: random min: 01:00:00 max: 02:00:00 - name: string type: varchar comment: A column with a random string DataGenerator: type: random min: a max: zzzzzzzz ==== Printing the data ==== With the [[docs:tabli:data:print|data print command]], we can print the ''30 values'' generated. tabli data print random--datagen.yml@howto [[docs:connection:howto|howto]] is the connection that contains the files used in the [[..:howto|HowTo's]]. id int rand_float rand_double numeric rand_date rand_timestamp rand_time string -- --- ---------- -------------------- ------- ---------- --------------------- --------- ------- 1 2 5.949046 7.334240632976011 13.45 2020-10-16 2020-10-01 01:04:55.0 01:59:23 dtwdqtt 2 0 3.8458169 6.917470410239475 17.37 2020-10-24 2020-10-01 01:41:48.0 01:47:56 cgzfbxu 3 1 0.5151166 5.894278028908796 12.24 2020-10-09 2020-10-01 01:31:37.0 01:47:29 dddulee 4 5 3.6544273 2.066366806912213 17.14 2020-10-19 2020-10-01 01:14:46.0 01:30:43 bykdzlk 5 3 7.9282465 3.0814429269694026 10.58 2020-10-25 2020-10-01 01:55:19.0 01:07:57 dyuwnpc 6 2 5.1251993 7.137018598795309 12.02 2020-10-19 2020-10-01 01:36:52.0 01:37:29 qaamnu 7 3 6.811733 7.075330683806021 19.23 2020-10-22 2020-10-01 01:07:47.0 01:24:05 bsdkorp 8 3 5.513641 3.1506205452746663 18.31 2020-10-30 2020-10-01 01:48:43.0 01:43:08 ehybxhr 9 0 2.4566748 3.7500275924077826 12.35 2020-10-08 2020-10-01 01:30:04.0 01:22:16 cquufuo 10 1 7.897481 3.3493473476849323 16.95 2020-10-30 2020-10-01 01:01:59.0 01:27:40 evqqzko 11 1 2.0761254 0.9849009627000829 18.79 2020-10-08 2020-10-01 01:54:58.0 01:17:14 drivpgo 12 1 6.821446 4.522769574847222 13.68 2020-10-19 2020-10-01 01:03:28.0 01:37:39 eapctsw 13 2 3.8404908 0.006640847321239818 15.76 2020-10-24 2020-10-01 01:40:22.0 01:57:26 exdmzpm 14 5 5.7232847 3.3655195946604524 13.10 2020-10-26 2020-10-01 01:45:08.0 01:23:08 cxvjoh 15 2 3.6941814 1.7625506111621627 11.69 2020-10-24 2020-10-01 01:43:17.0 01:20:47 bjhzeaa 16 3 6.1410446 1.8662069753044594 11.21 2020-10-05 2020-10-01 01:09:54.0 01:19:38 spgmkf 17 2 7.953512 4.325088311622337 13.35 2020-10-05 2020-10-01 01:44:58.0 01:10:29 cniianx 18 3 4.701595 5.727585561426775 11.06 2020-10-23 2020-10-01 01:43:18.0 01:45:23 degzpaf 19 5 7.6858525 3.32765728025669 18.30 2020-10-24 2020-10-01 01:36:43.0 01:01:13 exqsund 20 5 1.8904049 3.8179689470575786 11.40 2020-10-27 2020-10-01 01:01:09.0 01:43:53 bkpvwot 21 4 6.8700266 7.431647395929477 19.09 2020-10-21 2020-10-01 01:36:39.0 01:25:31 dbrggrx 22 4 2.602568 4.653896192996839 18.40 2020-10-29 2020-10-01 01:42:48.0 01:21:37 blnylqi 23 1 4.337965 0.8247261554054965 14.56 2020-10-22 2020-10-01 01:07:16.0 01:30:22 eziyogv 24 4 4.475076 5.914048325115427 12.18 2020-10-27 2020-10-01 01:00:31.0 01:51:03 bopwkug 25 3 5.497604 0.7503798394018828 14.64 2020-10-05 2020-10-01 01:03:56.0 01:34:01 dlvucsv 26 4 2.000347 4.9844142426633775 18.34 2020-10-28 2020-10-01 01:14:36.0 01:48:48 bsnunad 27 4 3.8370354 6.0687039992400695 15.92 2020-10-20 2020-10-01 01:44:08.0 01:13:06 dpnufcq 28 5 2.4209976 6.534706692236394 15.98 2020-10-30 2020-10-01 01:04:20.0 01:19:08 dknrrah 29 3 0.2099089 0.8484447542140581 16.18 2020-10-03 2020-10-01 01:27:40.0 01:29:57 xgywvt 30 2 1.405872 7.126028009377373 14.42 2020-10-08 2020-10-01 01:44:51.0 01:12:35 csnmnga ===== Next ===== Because a [[docs:resource:generator|generator]] is just a [[docs:resource:resource|data resource]], you can use it in every [[docs:op:op|data operation]]. [[generator_data_operation|How to use a generator in a data operation ]]