Examples for Specifying Patterns

The following examples illustrate ways to filter the data in a response from an API metadata request. By using filter parameters, such as tablePattern and schemasPattern in your request URL, you can obtain subsets of data.
Filter Parameters
The filter parameters use patterns to return subsets of data. A pattern is a sequence of characters present in a field; only those fields that match the pattern are returned. For example, the tablePattern parameter when specified as "tablePattern=DIVISON" returns only the tables named "DIVISION."
To filter the data returned by a filter parameter at an even finer level, you can use wildcard characters (wildcards) in your specification. Wildcards are used to obtain only those fields that match a pattern that is specified in a query.
Use of Wildcards
A wildcard character represents one or more characters in a string. The filter parameters use the wildcards
%
and
_
according to the following rules:
  • Within a pattern string,
    %
    means match any substring of 0 or more characters, and
    _
    means match any one character. Only metadata entries matching the search pattern are returned. The position of the wildcard character makes a difference in what matches are returned:
    • A wildcard at the end of a pattern (for example,
      EMP%
      ) means that the text after the text
      EMP
      is wild. A match could be
      EMPADDRESS
      , for example.
    • A wildcard at the beginning of a pattern (for example,
      %EMP
      ) means the characters before
      EMP
      is wild. A match could be
      RETEMP
      , for example.
    • A wildcard on either side of a pattern, for example,
      %EMP%
      means any string with
      EMP
      in the middle with an unknown number of wild characters before and after it is a match. Matches could include
      RETEMPADDRESS
      and
      ACTIVEEMPADDRESS
      , for example.
  • In the URL, the
    %
    must be encoded as
    %25
    .
  • In the request body, commands are supplied as a list of strings.
Examples
The examples in this topic are based on the following sample fields from an employee database: table schema, table name, and column name. Each example provides a specified pattern and the set of data it returns based on the following URI: https://zoshost.domain.com:10010/api/v1/sql/columns/SYSDEMO?
Sample Database for Pattern Examples
Sample Database for Pattern Examples
Example 1. Return columns with names that include the text "NAME"
columnPattern=%25NAME%25
Example 1 Return columns with names that include the text name
Example 2. Return columns containing tables with the text "DEPARTMENT" and "NAME" in the name 
tablePattern=DEPARTMENT&columnPattern=%25NAME%25
Example 2. Return columns containing tables with the text "DEPARTMENT" and "NAME" in the name
Example 3. Return columns containing:
  • Schemas with names that start with "DEMO"
  • Columns that include the text "NAME"
schemaPattern=DEMO%25&columnPattern=%25NAME%25
Example 3. Return columns containing certain schemas and the text name
Example 4. Return columns containing tables with names that:
  • Consist of at least three characters
  • Have an "E" as the second character
  • Have at least one character after the "E"
schemaPattern=_E_%25
Example 4 Return Columns with name that have 3 characters, e as a second character and at lease one character after the e
Example 5. Return columns containing tables with names that begin with "DE"
tablePattern=DE%25
Example 6. Return columns containing:
  • Schemas with "EL" as the second and third characters in the name
  • Tables with names that begin with "DE"
schemaPattern=_EL%25&tablePattern=DE%25
Example 6 Return columns that have schemas with EL as the second and third characters in the name and tables with names that begin with DE