Description

Specify the SCHEMA and compute resources for the current session

Syntax

--Switch schema
USE [SCHEMA] schema_name;
--Switch computing resources
USE VCLUSTER vc_name;

Parameter Description

  1. SCHEMA: This is an optional keyword and can be omitted in the statement.
  2. schema_name: Specifies the name of the schema to switch to.

Examples

  1. Switch to the schema named ods_schema:
USE ods_schema;
    -- Query the current SCHEMA
SELECT CURRENT_SCHEMA();
  1. Assuming there is a compute cluster named sample_vc in the current workspace, you can switch to this compute cluster using the following command:
USE VCLUSTER sample_vc;
 --Query the current computing resources
 SELECT CURRENT_VCLUSTER();
  1. If you want to switch to the computing cluster named high_performance_vc, you can execute the following command:
    USE VCLUSTER high_performance_vc;

Notes

  • When connecting using client tools (such as Client SQLLine, DBeaver, etc.), the relevant operations will take effect for the entire session. If you are using the Lakehouse Studio interface, it is recommended to switch Schemas and compute clusters via the page. It should be noted that if you directly use the relevant commands, their effects will only be temporary and will only take effect if selected together with the SQL to be executed.