---json
{
"aliases": [
{ "path": ":howto:postgres:list" },
{ "path": ":howto:sqlite:tabul_list" }
],
"canonical": ":howto:database:list_tables",
"description": "This howto will show you how to list SQL Tables",
"name": "List SQL Tables",
"page_id": "ti042d7ozr9x2d92q3r5g"
}
---
====== Tabul - How to list SQL Tables ======
===== About =====
This [[howto:howto|How-to]] will show you how to use the [[docs:tabul:data:list|tabul data list]] command to list [[docs:resource:sql_table|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 [[:docs:connection:tpcds|TPCDS schema]] to be able to demonstrate the query capabilities
with the [[:docs:tabul:data:create|create command]]
tabul data create *@tpcds @sqlite
==== Listing all tables ====
Listing all the tables from the [[docs:connection:tpcds|Tpcds connection]] with a [[docs:flow:data_selector|data uri selector]] and the star ''*'' [[docs:flow:data_selector#glob pattern|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 [[docs:connection:tpcds|Tpcds connection]] and its [[docs:resource:dependency|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 [[docs:flow:data_selector|data uri selector]] and its [[docs:flow:data_selector#glob pattern|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 [[docs:system:tpcds|tpcds]], the [[docs:flow:data_selector#glob pattern|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