Table of Contents

Tabulify - How to select data resources with a Glob Pattern

About

With this page, you will learn what a glob pattern is and how to use it to select data resources.

A glob pattern or glob expression is a string that can be matched or not against another string. If the glob pattern matches, a data resource name, the data resource is selected otherwise it's not.

To express the pattern, special characters called wildcard are used that have special meaning. The following paragraphs go through each of this wildcard and shows you how to use them.

For the hackers, this is like a regular expression but simplified

Steps

Prerequisites

You should have Tabulify installed on your computer.

Learning Tabulify - Step 1 - Installation

Star

The star character * also known as asterix matches any number of characters.

If we want to select all data resources that ends with the term sales, we will use the following glob pattern

*sales

where:

Example:

tabli data list *sales@tpcds
PATH            
-------------   
catalog_sales   
store_sales     
web_sales

Question mark

A question mark, ?, matches exactly one character.

Example:

tabli data list ????@tpcds
PATH   
----   
item

tabli data list w?*sales@tpcds
PATH        
---------   
web_sales

Braces

Braces {} specify a collection of subpatterns.

For example:

tabli data list {item,store}@tpcds
PATH    
-----   
item    
store

tabli data list {web*,store*}@tpcds
PATH            
-------------   
store           
store_returns   
store_sales     
web_page        
web_returns     
web_sales       
web_site

Square brackets

Square brackets [] convey:

that matches a single character. Within the square brackets, the wildcard *, ?, and \ match themselves.

Example:

Example:

tabli data list *[wy]*@tpcds
PATH                   
--------------------   
inventory              
s_inventory            
s_warehouse            
s_web_order            
s_web_order_lineitem   
s_web_page             
s_web_returns          
s_web_site             
warehouse              
web_page               
web_returns            
web_sales              
web_site

You can also search container such as directory or schema recursively by adding to your glob pattern the double start (or asterix).

For instance, the below patter will search the file that starts with RE in the current directory and all sub-directories of the howto connection directory

tabli data list **/RE*@howto
PATH                  
-------------------   
README.md             
recursive\README.md

Escape

The escape character is the backslash \ and turns a wildcard into a simple characters.

Syntax

\wildcard

For example:

This is almost always not needed because most of the wildcard are already not allowed when naming resource such as file or table.