Skip to Content
SQL ReferenceUser Management

User Management

KalamDB includes built-in authentication and role-based access control (RBAC).

CREATE USER

sql snippetSQL
CREATE USER '<username>'  WITH <PASSWORD '<password>' | OAUTH '<json-auth-data>' | INTERNAL>  ROLE <user|service|dba|system>  [EMAIL '<email>'];

Roles

RoleDescription
userStandard user — access to own tables
serviceService account — for bots and integrations
dbaDatabase administrator — full table management
systemSystem-level — unrestricted access

Examples

sql snippetSQL
-- Create a regular user with passwordCREATE USER 'alice'  WITH PASSWORD 'SecurePass123!'  ROLE user  EMAIL 'alice@example.com'; -- Create a service accountCREATE USER 'chat_bot'  WITH PASSWORD 'BotSecret456!'  ROLE service; -- Create an OAuth-mapped user (provider + subject are required)CREATE USER 'alice_oauth'  WITH OAUTH '{"provider":"google","subject":"google-user-123"}'  ROLE user  EMAIL 'alice@example.com'; -- Create a DBACREATE USER 'admin'  WITH PASSWORD 'AdminPass789!'  ROLE dba  EMAIL 'admin@example.com';

ALTER USER

sql snippetSQL
-- Change passwordALTER USER '<username>' SET PASSWORD '<new_password>'; -- Change roleALTER USER '<username>' SET ROLE <user|service|dba|system>; -- Update emailALTER USER '<username>' SET EMAIL '<new_email>';

Examples

sql snippetSQL
ALTER USER 'alice' SET PASSWORD 'NewSecurePass!';ALTER USER 'alice' SET ROLE dba;ALTER USER 'alice' SET EMAIL 'alice.new@example.com';

DROP USER

sql snippetSQL
DROP USER '<username>';DROP USER IF EXISTS '<username>';

Dropping a user also removes their per-user storage directory, providing GDPR-compliant data deletion.

sql snippetSQL
DROP USER IF EXISTS 'alice';
Last updated on