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
You should have Tabulify installed on your computer.
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:
tabul data list *sales@tpcds
path media_type
------------- ------------
catalog_sales sql/relation
store_sales sql/relation
web_sales sql/relation
A question mark, ?, matches exactly one character.
Example:
tabul data list ????@tpcds
path media_type
---- ------------
item sql/relation
tabul data list w?*sales@tpcds
path media_type
--------- ------------
web_sales sql/relation
Braces {} specify a collection of subpatterns.
For example:
tabul data list {item,store}@tpcds
path media_type
----- ------------
item sql/relation
store sql/relation
tabul data list {web*,store*}@tpcds
path media_type
------------- ------------
store sql/relation
store_returns sql/relation
store_sales sql/relation
web_page sql/relation
web_returns sql/relation
web_sales sql/relation
web_site sql/relation
Square brackets [] convey:
that matches a single character. Within the square brackets, the wildcard *, ?, and \ match themselves.
Example:
Example:
tabul data list *[wy]*@tpcds
path media_type
-------------------- ------------
inventory sql/relation
s_inventory sql/relation
s_warehouse sql/relation
s_web_order sql/relation
s_web_order_lineitem sql/relation
s_web_page sql/relation
s_web_returns sql/relation
s_web_site sql/relation
warehouse sql/relation
web_page sql/relation
web_returns sql/relation
web_sales sql/relation
web_site sql/relation
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
tabul data list **/RE*@howto
path media_type
-------------------------------------- ----------
dataset/world/README.md text/plain
email/README.md text/plain
mysql/coffee-break-sample-db/README.md text/plain
README.md text/plain
recursive/README.md text/plain
The escape character is the backslash \ and turns a wildcard into a simple characters.
Syntax
\wildcard
For example: