How to copy the data definition of all tables from a star/snowflake schema

About

This Howto will show you how to copy the data definition of all SQL tables from a star/snowflake schema by using the Tabli data create command.

This command does not copy the data. It just create the structure (ie it performs a SQL CREATE statement). If you want to copy the data, use the tabli data transfer command instead.

Steps

Prerequisites

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

Select the fact table

The trick to copy a star/snowflake schema is:

  • to give the fact table (ie the table at the center of the star/snowflake schema) to the Tabli table create command
  • and to ask to create it with its dependencies.

Create the fact table with its dependencies

The below command will create:

tabli data create --with-dependencies store_sales@tpcds tpc_$0@sqlite
The list of data resources created
uri
---------------------------------
tpc_customer@sqlite
tpc_customer_address@sqlite
tpc_customer_demographics@sqlite
tpc_date_dim@sqlite
tpc_household_demographics@sqlite
tpc_income_band@sqlite
tpc_item@sqlite
tpc_promotion@sqlite
tpc_store@sqlite
tpc_store_sales@sqlite
tpc_time_dim@sqlite

List the created tables

With the tabli data list command, we can list the tables created with the tpc prefix.

tabli data list -a name -a count tpc*@sqlite
count
-----
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0

Next

You can fill them with generated data.

How to fill a schema with generated data




Related Pages
Undraw Server
How to create a table with a CREATE Sql statement file

This Howto will show you how to create a SQL table with a SQL file that contains a ''CREATE'' SQL statement
Undraw Server
How to fill a database relational schema with generated data and tabli

This how-to will show you how to use the tabli fill command to fill all the tables of a schema with generated data.
Undraw Server
Tabulify - Relational Database

Tabulify supports relational database as a system type. You can: add/create/update database connections parameters perform operation on a SQL query perform operation on a table perform operation...

Task Runner