Drop CONNECTION

Description

In the Lakehouse, the DROP CONNECTION operation is used to remove connection objects that are no longer needed. CONNECTION objects store connection information with external services, including authentication credentials and access permissions.

Syntax

The basic syntax for dropping a CONNECTION is as follows:

DROP CONNECTION [IF EXISTS] connection_name;

Parameters

  • connection_name: The name of the CONNECTION object to drop.
  • IF EXISTS (optional): Skip the operation if the CONNECTION does not exist, without raising an error. Suitable for automation scripts or batch drop scenarios.

Examples

  1. Drop a specific CONNECTION object:

    DROP CONNECTION my_connection;

    Executing this command will drop the CONNECTION object named my_connection. Before performing the drop operation, it is recommended to confirm that the CONNECTION is no longer used by any queries or jobs.

  2. Check if the CONNECTION exists before dropping:

    DROP CONNECTION IF EXISTS my_connection;

    Using the IF EXISTS option avoids errors when attempting to drop a CONNECTION that may not exist. This is especially useful in automation scripts or batch drop operations, ensuring smooth execution even if certain CONNECTIONS no longer exist.