pyflink.table.table_environment.TableEnvironment.use_catalog#
- TableEnvironment.use_catalog(catalog_name: str)[source]#
Sets the current catalog to the given value. It also sets the default database to the catalog’s default one. See also
use_database()
.This is used during the resolution of object paths. Both the catalog and database are optional when referencing catalog objects such as tables, views etc. The algorithm looks for requested objects in following paths in that order:
[current-catalog].[current-database].[requested-path]
[current-catalog].[requested-path]
[requested-path]
Example:
Given structure with default catalog set to
default_catalog
and default database set todefault_database
.root: |- default_catalog |- default_database |- tab1 |- db1 |- tab1 |- cat1 |- db1 |- tab1
The following table describes resolved paths:
Requested path
Resolved path
tab1
default_catalog.default_database.tab1
db1.tab1
default_catalog.db1.tab1
cat1.db1.tab1
cat1.db1.tab1
- Parameters
catalog_name – The name of the catalog to set as the current default catalog.
- Throws
CatalogException
thrown if a catalog with given name could not be set as the default one.
See also
use_database()