This Howto will show you how to copy the data definition of a SQL table from another SQL table by using the Tabul table 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 tabul data transfer command instead.
You should have Tabulify installed on your computer.
tabul data drop --no-strict-selection *@sqlite
The below command will create:
tabul data create store_sales@tpcds tpcds_sales@sqlite
where:
Results of the create operation
input target
----------------- ------------------
store_sales@tpcds tpcds_sales@sqlite
Check the metadata with the tabul data meta command
tabul data describe tpcds_sales@sqlite
Structure of the resource tpcds_sales@sqlite
position name type precision scale primary_key nullable autoincrement comment
-------- --------------------- ------- --------- ----- ----------- -------- ------------- -------
1 ss_sold_date_sk integer 0 0 x
2 ss_sold_time_sk integer 0 0 x
3 ss_item_sk integer 0 0 x
4 ss_customer_sk integer 0 0 x
5 ss_cdemo_sk integer 0 0 x
6 ss_hdemo_sk integer 0 0 x
7 ss_addr_sk integer 0 0 x
8 ss_store_sk integer 0 0 x
9 ss_promo_sk integer 0 0 x
10 ss_ticket_number integer 0 0 x
11 ss_quantity integer 0 0 x
12 ss_wholesale_cost decimal 7 2 x
13 ss_list_price decimal 7 2 x
14 ss_sales_price decimal 7 2 x
15 ss_ext_discount_amt decimal 7 2 x
16 ss_ext_sales_price decimal 7 2 x
17 ss_ext_wholesale_cost decimal 7 2 x
18 ss_ext_list_price decimal 7 2 x
19 ss_ext_tax decimal 7 2 x
20 ss_coupon_amt decimal 7 2 x
21 ss_net_paid decimal 7 2 x
22 ss_net_paid_inc_tax decimal 7 2 x
23 ss_net_profit decimal 7 2 x
You can also create a table and its dependencies (foreign tables) at once with the tabul data create command.
How to copy a star/snowflake schema ?