Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
    • TableEnvironment
    • Table
    • Data Types
    • Window
    • Expressions
    • User Defined Functions
    • Descriptors
    • StatementSet
    • Catalog
  • PyFlink DataStream
  • PyFlink Common

pyflink.table.table_environment.StreamTableEnvironment.use_database#

StreamTableEnvironment.use_database(database_name: str)#

Sets the current default database. It has to exist in the current catalog. That path will be used as the default one when looking for unqualified object names.

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 to default_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

Throws

CatalogException thrown if the given catalog and database could not be set as the default ones.

See also

use_catalog()

Parameters

database_name – The name of the database to set as the current database.

previous

pyflink.table.table_environment.StreamTableEnvironment.use_catalog

next

pyflink.table.table_environment.StreamTableEnvironment.use_modules

Show Source

Created using Sphinx 4.5.0.