Tabli - How to fill a table with auto generated data

About

This how-to will show you how to fill a table with auto-generated data and the Tabli fill action.

Steps

Prerequisites

You should have Tabulify installed on your computer. Learning Tabulify - Step 1 - Installation

Create the target table

For the purpose of this how-to, we will work with the date_dim TPC-DS table.

tabli data create date_dim@tpcds @sqlite
The list of data resources created
uri
---------------
date_dim@sqlite

Fill the date_dim table with 10 rows

With the tabli data fill operation, insert 10 rows automatically generated into the table date_dim

tabli data fill --max-record-count 10 date_dim@sqlite
Source            Target            Latency (ms)   Row Count   Error   Message
---------------   ---------------   ------------   ---------   -----   -------
date_dim@memgen   date_dim@sqlite   30             10

Check the result

With the data print command, we can see the content of the date_dim table in the sqlite connection

tabli data print date_dim@sqlite
d_date_sk   d_date_id   d_date       d_month_seq   d_week_seq   d_quarter_seq   d_year   d_dow   d_moy   d_dom   d_qoy   d_fy_year   d_fy_quarter_seq   d_fy_week_seq   d_day_name   d_quarter_name   d_holiday   d_weekend   d_following_holiday   d_first_dom   d_last_dom   d_same_day_ly   d_same_day_lq   d_current_day   d_current_week   d_current_month   d_current_quarter   d_current_year
---------   ---------   ----------   -----------   ----------   -------------   ------   -----   -----   -----   -----   ---------   ----------------   -------------   ----------   --------------   ---------   ---------   -------------------   -----------   ----------   -------------   -------------   -------------   --------------   ---------------   -----------------   --------------
        1   a           2020-12-07             1            1               6        4       7       8       9       8           5                  1               9   s            p                y           f           x                               7            0               5              10   r               c                o                 c                   h
        2   b           2020-12-04             1            6               4        8       7       5      10       4           7                  0               4   l            u                b           i           l                              10            1               9               0   g               w                r                 s                   j
        3   c           2020-12-12             0            1               6        8       2       2       7       8           5                  3              10   i            b                i           i           z                               2            6               3               5   t               w                a                 b                   t
        4   d           2020-12-02             2            4               7        4      10       9      10       6           7                  0               3   k            t                f           l           n                               1            6               4               4   i               l                g                 u                   n
        5   e           2020-12-12             9            2               4        9       7       2       4       8           3                  7               9   j            b                g           n           o                              10            9               0              10   w               i                w                 o                   l
        6   f           2020-12-03             2            8              10        9       0       5       0       5           3                  0              10   r            y                e           g           u                               7            5               6              10   a               o                o                 d                   f
        7   g           2020-12-06             6           10               7        3      10       9       6       8           3                  2               4   o            h                d           l           w                              10            3               1               2   k               t                o                 k                   o
        8   h           2020-12-05             1            3               4        1       5       6       0       1           7                  9               2   q            m                w           w           p                               6            2               0               9   y               h                y                 a                   l
        9   i           2020-12-05             0            4               5       10       6       1       5       7           4                  2              10   k            f                s           o           c                               4            5               9               2   o               q                f                 y                   e
       10   j           2020-12-08             7            5               6        6       9       6       6       0           3                  8               4   m            r                s           a           u                               9            9              10               9   l               j                l                 a                   v

Fill the date_dim table with 10.000 rows

tabli data fill --max-record-count 10000 date_dim@sqlite
Source            Target            Latency (ms)   Row Count   Error   Message
---------------   ---------------   ------------   ---------   -----   -------
date_dim@memgen   date_dim@sqlite   1180           10000

Check the result

And we got 10.000 rows

tabli data list -a count date_dim@sqlite
count
-----
10000

Next

The generated data follows a default definition but you can define the generated data that you want with the help of a data definition file.

Learn how to fill a table with defined generated data

Task Runner