Tabul - How to list SQL Tables

About

This How-to will show you how to use the tabul data list command to list SQL Table.

Steps

Create the TPCDS schema

  • Delete all tables to start with a clean state
tabul data drop --no-strict-selection *@sqlite
  • Create all tables of the TPCDS schema to be able to demonstrate the query capabilities

with the create command

tabul data create *@tpcds @sqlite

Listing all tables

Listing all the tables from the Tpcds connection with a data uri selector and the star * glob wildcard character

tabul data list *@sqlite
path                       media_type
------------------------   ----------
call_center                table
catalog_page               table
catalog_returns            table
catalog_sales              table
customer                   table
customer_address           table
customer_demographics      table
date_dim                   table
dbgen_version              table
household_demographics     table
income_band                table
inventory                  table
item                       table
promotion                  table
reason                     table
s_call_center              table
s_catalog_order            table
s_catalog_order_lineitem   table
s_catalog_page             table
s_catalog_returns          table
s_customer                 table
s_customer_address         table
s_inventory                table
s_item                     table
s_promotion                table
s_purchase                 table
s_purchase_lineitem        table
s_store                    table
s_store_returns            table
s_warehouse                table
s_web_order                table
s_web_order_lineitem       table
s_web_page                 table
s_web_returns              table
s_web_site                 table
s_zip_to_gmt               table
ship_mode                  table
store                      table
store_returns              table
store_sales                table
time_dim                   table
warehouse                  table
web_page                   table
web_returns                table
web_sales                  table
web_site                   table

Listing one table with its dependencies

Listing the table store_sales from the Tpcds connection and its dependencies

tabul data list --with-dependencies store_sales@sqlite
path                     media_type
----------------------   ----------
customer                 table
customer_address         table
customer_demographics    table
date_dim                 table
household_demographics   table
income_band              table
item                     table
promotion                table
store                    table
store_sales              table
time_dim                 table

Filtering the output with a glob pattern

Listing all returns

Listing all the tables that have return in their name with a data uri selector and its glob pattern

tabul data list *return*@sqlite
path                media_type
-----------------   ----------
catalog_returns     table
s_catalog_returns   table
s_store_returns     table
s_web_returns       table
store_returns       table
web_returns         table

Listing all returns and sales tables

With tpcds, the glob expression {*returns,*sales} will returns all returns and sales tables.

tabul data list {*returns,*sales}@sqlite
path                media_type
-----------------   ----------
catalog_returns     table
catalog_sales       table
s_catalog_returns   table
s_store_returns     table
s_web_returns       table
store_returns       table
store_sales         table
web_returns         table
web_sales           table

Task Runner