Purpose

Specifies a comma-separated list of database and collection pairs for which you want the driver to fetch metadata. This property can significantly improve connection times by limiting the collections for which metadata is fetched to only those that are required by your application. If you do not specify a value, the driver fetches metadata for all the collections in every database that your account has access to, which can adversely impact performance during the initial connection to a database.

Valid Values

database_name:collection_name[[,*database_name*:`collection_name]...]

where:

database_name

is a literal value or regular expression for the database that contains collections for which the driver fetches metadata.

collection_name

is a literal value or regular expression of the collection for which the driver fetches metadata.

A schema or table name value can be:

  • A literal name that does not contain either a comma ( , ) or a colon ( : )

  • A literal name that contains a comma ( , ) or a colon ( : ) that is bounded by a slash ( / ) at the beginning and end. For example, a collection named sales:2019 would be represented by /sales:2019/

  • A regular expression bounded by a slash ( / ) at the beginning and end, such as /sales.*\d/

  • An asterisk ( * ), which represents all databases or collections within the corresponding schema(s).

Example

Literal values: The following example returns metadata for only the november and march collections in the oem_sales database.

SchemaFilter=oem_sales:november,oem_sales:march

Wildcard values: If you want the driver to fetch metadata for all the tables in a schema, replace the value for the table or schema name with an * (wildcard) character. For example, the following returns metadata for all the tables in the oem_sales and for tables named customers in all databases.

SchemaFilter=oem_sales:*,*:customers

Partial wildcard values: You can also use the asterisk to specify partial values for databases and collections. For example, the following returns metadata for all tables that end with region that are in schemas that begin with sales.

SchemaFilter=/sales.*/:/.*region/

Regular expressions: The following returns metadata for tables named tax in all databases that start with year which end with a number.

SchemaFilter=*/year.*\d/:tax

Notes

  • The setting for this property is written to the configuration file when generating the schema map. If you attempt a subsequent connection using the configuration file and specify a different value for this property, the driver will return an error.

Data Source Methods

public String getSchemaFilter()

public void setSchemaFilter(String)

Default Value

No default value

Data Type

String