Updated on 2024-10-25 GMT+08:00

CREATE VIRTUAL SCHEMA

CREATE/DROP/SHOW VIRTUAL SCHEMA(S)

  • CREATE

    The CREATE statement in HetuEngine is used to create a schema mapping and open the local domain data source to external systems based on the mapping information.

    The syntax is as follows:

    CREATE VIRTUAL SCHEMA [ IF NOT EXISTS ] [ ctlg_dest.]schema_name WITH ( [catalog = ctlg_name,] schema = schm_name, [property_name = expression, ...] ) 

    To create a virtual schema, provide the mapped schema information in WITH.

    ctlg_dest indicates the data source where the virtual schema is to be created. This parameter is optional. If this parameter is not specified, the catalog in the current session is used. If no catalogs are available in the current session, the creation will fail.

    WITH and schema are mandatory. The catalog parameter is optional. If catalog is not specified, the catalog in the current session is used.

    Example statement:

    CREATE VIRTUAL SCHEMA hive_default WITH (catalog = 'hive', schema = 'default');
  • DROP

    The DROP statement in HetuEngine is used to delete a schema mapping.

    The syntax is as follows:

    DROP VIRTUAL SCHEMA [ IF EXISTS ] schema_name 

    schema_name can be replaced with a fully qualified name (catalogName.virtualSchema).

    Example statement:

    DROP VIRTUAL SCHEMA hive_default;
  • SHOW

    The SHOW statement in HetuEngine is used to query all schema mappings.

    The syntax is as follows:

    SHOW VIRTUAL SCHEMAS [ FROM catalog ] [ LIKE pattern ] 

    Example statement:

    SHOW VIRTUAL SCHEMAS;