Skip to content
Blog

Call

The CALL clause is used for executing schema functions. The following tables lists the built-in schema functions:

FunctionDescription
TABLE_INFO('tableName')returns metadata information of the given table
CURRENT_SETTING('setting')returns the value of the given setting
DB_VERSION()returns the version of Kùzu
SHOW_TABLES()returns the name, type, comment of all tables in the database
SHOW_CONNECTION('tableName')returns the source/destination nodes for a relationship/relgroup in the database
SHOW_ATTACHED_DATABASES()returns the name, type of all attached databases

TABLE_INFO

TABLE_INFO takes table name as a parameter and returns metadata information of the table.

ColumnDescriptionType
property idInternal identifier of the property within tableINT64
namename of the propertySTRING
typedata type of the propertySTRING
primary keyif property is primary keyBOOLEAN
CALL TABLE_INFO('User') RETURN *;

Output:

---------------------------------------------
| property id | name | type | primary key |
---------------------------------------------
| 0 | name | STRING | True |
---------------------------------------------
| 1 | age | INT64 | False |
---------------------------------------------

CURRENT_SETTING

CURRENT_SETTING returns the value of given database configuration.

CALL current_setting('threads') RETURN *;

Output:

-----------
| threads |
-----------
| 8 |
-----------

DB_VERSION

DB_VERSION returns current database version.

ColumnDescriptionType
versiondatabase versionSTRING
CALL db_version() RETURN *;

Output:

----------------
| KUZU_Version |
----------------
| v0.3.2 |
----------------

SHOW_TABLES

SHOW_TABLES returns the name, type and comment of all tables in the database.

ColumnDescriptionType
namename of the tableSTRING
typetype of the tableSTRING
commentcomment of the tableSTRING
CALL show_tables() RETURN *;

Output:

--------------------------------------------
| name | type | comment |
--------------------------------------------
| gf | RDF | |
--------------------------------------------
| gf_TRIPLES | REL | |
--------------------------------------------
| gf_RESOURCE | NODE | |
--------------------------------------------
| person | NODE | person info |
--------------------------------------------
| knows | REL | person knows person |
--------------------------------------------

SHOW_CONNECTION

SHOW_CONNECTION returns the source/destination nodes for a relationship/relationship group in the database.

ColumnDescriptionType
source table namename of the source node tableSTRING
destination table namename of the destination node tableSTRING
source table primary keyprimary key of the source node tableSTRING
destination table primary keyprimary key of the destination node tableSTRING

Show connection on a relationship table:

CALL show_connection('knows') RETURN *;

Output:

---------------------------------------------------------------------------------------------------------
| source table name | destination table name | source table primary key | destination table primary key |
---------------------------------------------------------------------------------------------------------
| person | person | name | name |
---------------------------------------------------------------------------------------------------------

Show connection on a relationship group:

CALL show_connection('knows') RETURN *;

Output:

----------------------------------------------
| source table name | destination table name |
----------------------------------------------
| user | person |
----------------------------------------------
| person | person |
----------------------------------------------

SHOW_ATTACHED_DATABASES

SHOW_ATTACHED_DATABASES returns the name, database type of all attached databases.

namedb_type
namename of the attached databases
db_typetype of the table
CALL show_attached_databases() RETURN *;

Output:

------------------------------------
| name | database type |
------------------------------------
| tinysnb | DUCKDB |
------------------------------------
| dbfilewithoutext | DUCKDB |
------------------------------------