Skip to Content
🚀 KalamDB v0.3.0-alpha2 is out — Learn more
SQL ReferenceNamespaces

Namespace Commands

Namespaces provide logical grouping for tables, similar to schemas in other databases.

CREATE NAMESPACE

CREATE NAMESPACE <namespace_name>; CREATE NAMESPACE IF NOT EXISTS <namespace_name>;

Example:

CREATE NAMESPACE IF NOT EXISTS chat; CREATE NAMESPACE IF NOT EXISTS analytics;

DROP NAMESPACE

DROP NAMESPACE <namespace_name>; DROP NAMESPACE IF EXISTS <namespace_name>; DROP NAMESPACE <namespace_name> CASCADE; DROP NAMESPACE IF EXISTS <namespace_name> CASCADE;

The CASCADE option drops all tables within the namespace.

Example:

-- Drop only if empty DROP NAMESPACE analytics; -- Drop with all contained tables DROP NAMESPACE IF EXISTS analytics CASCADE;

ALTER NAMESPACE

ALTER NAMESPACE <namespace_name> SET DESCRIPTION '<description>';

Example:

ALTER NAMESPACE chat SET DESCRIPTION 'Chat application tables';

USE / SET NAMESPACE

Set the default namespace for subsequent commands:

USE <namespace_name>; USE NAMESPACE <namespace_name>; SET NAMESPACE <namespace_name>;

Example:

USE chat; -- Now you can reference tables without the namespace prefix SELECT * FROM messages;

SHOW NAMESPACES

List all available namespaces:

SHOW NAMESPACES;
Last updated on