Table of Contents

About

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

Steps

Start Postgres

The next steps will be using the postgres howto connection.

tabul service start postgres
1 service was started
Name       Type
--------   ------
postgres   docker

  • Ping your connection to check that the database is up.
tabul connection ping postgres
The connection (postgres) has been pinged successfully

Create the TPCDS schema

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

with the create command

tabul data create *@tpcds @postgres

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 *@postgres
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@postgres
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*@postgres
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}@postgres
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