账户和会话 DDL

以下 DDL 命令用于查看和管理账户级操作和会话操作,包括:

  • 查看系统中多个级别的参数(账户、会话、对象)。
  • 在账户级别和会话中设置参数。
  • 在会话中使用角色、仓库、数据库或架构。
  • 在会话中使用多语句事务。
  • 在会话中设置和使用 SQL 变量。

账户参数和函数

ALTER ACCOUNTFor setting parameters at the account-level; can only be performed by users with the ACCOUNTADMIN role.
SHOW FUNCTIONSDisplays system-defined functions, as well as any user-defined functions.
SHOW PARAMETERSFor viewing parameter settings for the account.

账户

CREATE ACCOUNTUsed to create accounts in an organization.
DROP ACCOUNT
SHOW ACCOUNTSLists the accounts in an organization.
SHOW ORGANIZATION ACCOUNTSUse SHOW ACCOUNTS instead.
SHOW REGIONS
UNDROP ACCOUNT

托管账户

CREATE MANAGED ACCOUNTCurrently used to create reader accounts for providers who wish to share data with non-Snowflake customers.
DROP MANAGED ACCOUNT
SHOW MANAGED ACCOUNTS

复制和故障转移/故障恢复

会话参数

ALTER SESSIONFor setting parameters within a session; can be performed by any user.
SHOW PARAMETERSFor viewing parameter settings for the session (or account); can also be used to view parameter settings for a specified object.

会话上下文

USE ROLESpecifies the primary role to use in the session.
USE SECONDARY ROLESSpecifies the secondary roles to use in the session.
USE WAREHOUSESpecifies the virtual warehouse to use in the session.
USE DATABASESpecifies the database to use in the session.
USE SCHEMASpecifies the schema to use in the session (specified schema must be in the current database for the session).
See also:

Context functions

查询

DESCRIBE RESULTDescribes the columns in the results from a specified query (must have been executed within the last 24 hours).
SHOW LOCKSFor use with multi-statement transactions.

会话事务

BEGINFor use with multi-statement transactions.
COMMITFor use with multi-statement transactions.
DESCRIBE TRANSACTIONDescribes the state of the transaction (e.g. committed, rolled back, running), etc.
ROLLBACKFor use with multi-statement transactions.
SHOW TRANSACTIONSLists all running transactions.

SQL 变量

SETFor defining SQL variables in the session.
SHOW VARIABLESFor showing SQL variables in the session.
UNSETFor dropping SQL variables in the session.