This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Context Functions

This section provides reference information for the context-related functions in PlaidCloud Lakehouse.

1 - CONNECTION_ID

Returns the connection ID for the current connection.

Analyze Syntax

func.connection_id()

Analyze Examples

func.connection_id()

┌──────────────────────────────────────┐
       func.connection_id()           
├──────────────────────────────────────┤
 23cb06ec-583e-4eba-b790-7c8cf72a53f8 
└──────────────────────────────────────┘

SQL Syntax

CONNECTION_ID()

SQL Examples

SELECT CONNECTION_ID();

┌──────────────────────────────────────┐
            connection_id()           
├──────────────────────────────────────┤
 23cb06ec-583e-4eba-b790-7c8cf72a53f8 
└──────────────────────────────────────┘

2 - CURRENT_USER

Returns the user name and host name combination for the account that the server used to authenticate the current client. This account determines your access privileges. The return value is a string in the utf8 character set.

Analyze Syntax

func.current_user()

Analyze Examples

func.current_user()

┌─────────────────────┐
 func.current_user() 
├─────────────────────┤
 'root'@'%'          
└─────────────────────┘

SQL Syntax

CURRENT_USER()

SQL Examples

SELECT CURRENT_USER();

┌────────────────┐
 current_user() 
├────────────────┤
 'root'@'%'     
└────────────────┘

3 - DATABASE

Returns the name of the currently selected database. If no database is selected, then this function returns default.

Analyze Syntax

func.database()

Analyze Examples

func.database()

┌─────────────────┐
 func.database() 
├─────────────────┤
 default         
└─────────────────┘

SQL Syntax

DATABASE()

SQL Examples

SELECT DATABASE();

┌────────────┐
 database() 
├────────────┤
 default    
└────────────┘

4 - LAST_QUERY_ID

Returns the last query ID of query in current session, index can be (-1, 1, 1+2)..., out of range index will return empty string.

Analyze Syntax

func.last_query_id(<index>)

Analyze Examples

func.last_query_id(-1)

┌──────────────────────────────────────┐
    func.last_query_id((- 1))         
├──────────────────────────────────────┤
 a6f615c6-5bad-4863-8558-afd01889448c 
└──────────────────────────────────────┘

SQL Syntax

LAST_QUERY_ID(<index>)

SQL Examples

SELECT LAST_QUERY_ID(-1);

┌──────────────────────────────────────┐
         last_query_id((- 1))         
├──────────────────────────────────────┤
 a6f615c6-5bad-4863-8558-afd01889448c 
└──────────────────────────────────────┘

5 - VERSION

Returns the current version of PlaidCloud LakehouseQuery.

Analyze Syntax

func.version()

Analyze Examples

func.version()

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                           func.version()                                                  
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 PlaidCloud LakehouseQuery v1.2.252-nightly-193ed56304(rust-1.75.0-nightly-2023-12-12T22:07:25.371440000Z) 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────┘

SQL Syntax

VERSION()

SQL Examples

SELECT VERSION();

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────┐
                                                version()                                                  
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
 PlaidCloud LakehouseQuery v1.2.252-nightly-193ed56304(rust-1.75.0-nightly-2023-12-12T22:07:25.371440000Z) 
└───────────────────────────────────────────────────────────────────────────────────────────────────────────┘