Skip to main content
Kinetica provides basic table-level role-based access control for users. It also allows global read/write and administrative access to be granted. For details about Kinetica security, see Security Concepts.
A limited set of user/role information can be extracted via function calls. See User/Security Functions for details.
Security features accessible via SQL include:

User Management

The ability to manage user accounts is available through SQL, using the following commands: See Users for details about users within Kinetica.

CREATE USER

Users can be added to the system and assigned permissions either directly or via roles. Optionally, the user can be associated with a resource group and/or be assigned a default schema.
CREATE USER Syntax
The password needs to be single-quoted and must not contain single quotes.

Examples

Two of the ways to create a new internal user with the user ID of jsmith and a password of secret are:
CREATE USER Example
To create an internal user with the user ID of jsmith, a password of secret, and assigning the memory_over_execution resource group:
CREATE USER with Resource Group Example
To create a user with an existing external LDAP user, the user name should match the LDAP user name and be prepended with the @ symbol; no password is supplied, as the user will be externally authenticated:
CREATE USER (External) Example

ALTER USER

Any of the following facets of a user can be altered, either individually or as a group:
ALTER USER Syntax
The password needs to be single-quoted and must not contain single quotes.

Examples

To alter a user with the user ID of jsmith, assigning a password of new_secret, and the memory_over_execution resource group:
ALTER USER with Resource Group Example
To unassign the memory_over_execution resource_group from the jsmith user:
ALTER USER Removing Resource Group Example

DROP USER

Any user, other than the default users, can be removed from the system. Note that any database objects created by a user will remain when the user is removed.
DROP USER Syntax

Examples

To drop an internal user jsmith:
DROP USER (Internal) Example
To drop an external LDAP user jsmith:
DROP USER (External) Example

SHOW SECURITY FOR User

For any one or more (or all) users in the system, the following can be listed: In addition, permissions, roles, & resource groups will be listed recursively for the roles the specified users have and the roles those roles have, etc. This allows the full set of permissions for a given user, both direct & inherited, to be viewed with one command.
SHOW SECURITY FOR User Syntax

Examples

To show the permissions, roles, resource group, and default schema for user jsmith:
SHOW SECURITY FOR User Example

Role Management

The ability to manage roles is available through SQL, using the following commands: See Roles for details about roles within Kinetica.

CREATE ROLE

A new role can be created as a container for permissions or other roles, though both of those must be granted to the role after its creation. Optionally, the role can be associated with a resource group.
CREATE ROLE Syntax

Examples

To create an analyst role:
CREATE ROLE Example
To create an executive role, assigning it the execution_over_memory resource group:
CREATE ROLE with Resource Group Example

ALTER ROLE

A role can have its associated resource group modified.
ALTER ROLE Syntax

Examples

To assign the memory_over_execution resource group to the analyst role:
ALTER ROLE Example
To unassign the resource group from the analyst role:
ALTER ROLE Removing Resource Group Example

DROP ROLE

Dropping a role will remove the associated permissions & roles granted through the role to all users with the role. Users & roles granted the same permissions either directly or via other roles will retain those permissions. Any role, other than the default roles, can be removed from the system.
DROP ROLE Syntax

Examples

To drop the analyst role:
DROP ROLE Example

SHOW SECURITY FOR Role

For any one or more (or all) roles in the system, the following can be listed: In addition, these attributes will be listed recursively for the roles the specified roles have and the roles those roles have, etc. This allows the full set of permissions for a given role, both direct & inherited, to be viewed with one command.
SHOW SECURITY FOR Role Syntax

Examples

To show the permissions, roles, and resource group for the analyst role:
SHOW SECURITY FOR Role Example

Privilege Management

The ability to manage user & role privileges is available through SQL, using the following commands: See Users for details about user accounts within Kinetica.

GRANT Role

Roles can be granted directly to users or other roles.
GRANT Role Syntax

Examples

To grant a role allowing access to analyst tables to the analyst role, and then grant that analyst role to user jsmith:
GRANT ROLE Example

GRANT SYSTEM Permission

System permissions can be granted directly to users or roles.

System Administration

GRANT System Administrative Permission Syntax

System Management

GRANT System Management Permission Syntax

User Administration

GRANT User Administrative Permission Syntax

Examples

To grant system administrator permission to jsmith:
GRANT SYSTEM ADMIN Example
To grant read access to all tables to the auditor role:
GRANT SYSTEM READ Example
To grant user administrator permission to jsmith:
GRANT USER ADMIN Example

GRANT Table Permission

Table permissions, which can be applied to tables and views, can be granted directly to users or roles. Row-level security can be invoked for SELECT privilege by specifying a WHERE clause expression. Column-level security can be invoked for SELECT privilege by specifying a list of accessible columns and/or column security functions.
GRANT Table Permission Syntax
GRANT Create Table Permission Syntax

Parameters

PRIVILEGES

Optional keyword for SQL-92 compatibility.

TABLE / SCHEMA

Optional SQL-92 keywords that disambiguate the object reference: TABLE selects a table/view in the user’s default schema (when the schema is omitted), while SCHEMA selects a schema.

<object reference>

The name of the table/view and/or schema to which access is being granted. the following forms are valid:
FormSelected Objects
<schema>.<object>Fully-qualified table or view name in the specified schema
.All existing tables & views that the granting user can see, across all schemas
*All existing schemas that the granting user can see, which will grant access to all tables and views in those schemas now and in the future
<schema>All tables and views in the specified schema now and in the future
<object>Table or view in the default schema. If a schema exists with the same name, it will be used. To avoid this, specify the fully-qualified object name.

<schema reference>

The schema the permission applies to (with the ALL or CREATE forms). If the IN [SCHEMA] clause is omitted, the permission applies across all schemas, both now and in the future. Wildcards are not permitted with the IN keyword.

<column list>

Optional comma-separated list of specific table columns and/or column security functions applied to columns on which to grant access; see Column-Level Security for details.

WHERE <expression>

Optional filter expression on the table to which access is being granted, determining to which rows of the target table the grantee will be given access; see Row-Level Security for details.

WITH GRANT OPTION

Grant this permission with a grant option to grant it to others.
WITH GRANT OPTION is not allowed when also granting with row or column restrictions.
The ALL permission corresponds to the native table_admin permission, which gives full read/write access as well as the additional permission either to ALTER and DROP the specified table.

Examples

For example, to grant full access on the network_config table to jsmith:
GRANT All Permissions on Table to User Example
To grant SELECT access on the network_config_history table to the analyst role:
GRANT Read on Table to Role Example
To grant full access on each of the tables & views within the example schema to the developer role:
GRANT All Permissions on Current Tables/Views in Schema to Role Example
To grant SELECT access on all schemas to the auditor role:
GRANT Read on Schemas to Role Example
To grant SELECT access on all current and future tables & views within the app_schema schema to the app_user role:
GRANT Read on Schema to Role Example
To grant full access on each of the schemas, tables, & views in the database individually to the dbadmin role:
GRANT All Permissions on All Schemas/Tables/Views to Role Example

Row-Level Security Examples

To grant SELECT access on an rx_order table for all orders placed since the year 2002:
GRANT Row-Level Access by Filter Example
To grant SELECT access on an rx_order table for only orders belonging to the current user:
GRANT Row-Level Access Tied to Current User Example

Column-Level Security Examples

To grant SELECT access on the following columns of an rx_order table:
  • obfuscated version of the orderer’s social security number
  • name of the prescription ordered
  • order date/time
GRANT Obfuscated Column-Level Access Example
To grant SELECT access on the following columns of an rx_order table:
  • masked version of the orderer’s social security number (last 4 digits)
  • name of the orderer
  • name of the prescription ordered
  • order date/time
GRANT Masked Column-Level Access Example

GRANT Credential Permission

Credential permissions, which allow management of credentials, can be granted directly to users or roles.
GRANT Credential Permission Syntax
GRANT Create Credential Permission Syntax

Examples

To grant read access on the credential named auser_azure_active_dir_creds to the auser user:
GRANT Credential Use Permission Example
To grant administrative access on the credential to the auser user:
GRANT Credential Administrative Permission Example

GRANT Data Source Permission

Data source permissions, which allow management of data sources, can be granted directly to users or roles.
GRANT Data Source Permission Syntax
GRANT Create Data Source Permission Syntax

Examples

To grant connect access on the data source named kin_ds to the auser user:
GRANT Data Source Use Permission Example
To grant administrative access on the data source named kin_ds_anon to the auser user:
GRANT Data Source Administrative Permission Example

GRANT Data Sink Permission

Data sink permissions, which allow management of data sinks, can be granted directly to users or roles.
GRANT Data Sink Permission Syntax
GRANT Create Data Sink Permission Syntax

Examples

To grant connect & load access on the data sink named kin_dsink to the auser user:
GRANT Data Sink Use Permission Example
To grant administrative access on the data sink named kin_dsink_http to the auser user:
GRANT Data Sink Administrative Permission Example

GRANT Directory Permission

KiFS directory permissions, which allow management of files within KiFS directories, can be granted directly to users or roles.
GRANT Directory Permission Syntax
GRANT Create Directory Permission Syntax

Examples

To grant read access on a directory named kdata to the kuser user:
GRANT Directory Read Permission Example
To grant write access on a directory named kdata to the kuser user:
GRANT Directory Write Permission Example

GRANT Function (UDF/UDTF) Permission

Function permissions, which allow management of UDFs/UDTFs, can be granted directly to users or roles.
GRANT Function (UDF/UDTF) Permission Syntax
GRANT Create Function (UDF/UDTF) Permission Syntax

Examples

To grant execute on the udf_sos_py_proc UDF to udf_user:
GRANT Function Execute Permission Example
To grant administrative access on every existing & future UDF, as well as the ability to manage Python UDF environments, to udf_user:
GRANT Function Administrative Permission Example

GRANT Graph Permission

Graph permissions, which allow management of graphs, can be granted directly to users or roles.
GRANT Graph Permission Syntax
GRANT Create Graph Permission Syntax

Examples

To grant query, match, solve, & show access on the graph named big_cities_graph to geo_user:
GRANT Graph Permission Example

GRANT Procedure Permission

Procedure permissions, which allow execution of SQL procedures, can be granted directly to users or roles.
GRANT Procedure Permission Syntax
GRANT Create Procedure Permission Syntax

Examples

To grant execute on the sqlp_weekly procedure to spuser:
GRANT EXECUTE PROCEDURE Permission Example

GRANT SQL-GPT Context Permission

SQL-GPT context permissions, which allow management of SQL-GPT contexts, can be granted directly to users or roles.
GRANT SQL-GPT Context Permission Syntax
GRANT Create SQL-GPT Context Permission Syntax

Examples

To grant read access on the SQL-GPT context named example.atc_ctx to the ctxuser user:
GRANT SQL-GPT Context Permission Example

GRANT Stream Permission

Stream permissions, which allow removal & display of streams, can be granted directly to users or roles.
GRANT Stream Permission Syntax
GRANT Create Stream Permission Syntax

Examples

To grant administrative access on the stream named kin_stream to the auser user:
GRANT Stream Administrative Permission Example

REVOKE Role

Roles can be revoked from users or other roles.
REVOKE Role Syntax

Examples

To revoke a role allowing access to analyst tables from the analyst role:
REVOKE Role from Role Example
To revoke the analyst role from user jsmith:
REVOKE Role from User Example

REVOKE SYSTEM Permission

System permissions can be revoked from users or roles.
REVOKE System Administrative Permission Syntax
REVOKE User Administrative Permission Syntax

Examples

To revoke system administrator permission from jsmith:
REVOKE SYSTEM ADMIN Example
To revoke read access to all tables from the auditor role:
REVOKE SYSTEM READ Example
To revoke user administrator permission from jsmith:
REVOKE USER ADMIN Example

REVOKE Table Permission

Table permissions, which can be applied to tables and views, can be revoked from users or roles. Row-level security can be revoked for SELECT privilege only by revoking SELECT privilege from the entire table.
Access to individual rows cannot be revoked; instead, full SELECT access should be revoked, followed by a grant of access to the appropriate rows.
Column-level security can be revoked for SELECT privilege by specifying a list of columns for which access will be revoked, regardless of any security functions that may have been applied to the column when granting access (HASH, MASK).
REVOKE Table Permission Syntax
REVOKE Create Table Permission Syntax

Parameters

PRIVILEGES

Optional keyword for SQL-92 compatibility

TABLE / SCHEMA

Optional SQL-92 keywords that disambiguate the object reference: TABLE selects a table/view in the user’s default schema (when the schema is omitted), while SCHEMA selects a schema.

<object reference>

The name of the table/view and/or schema to which access is being revoked; the following forms are valid:
FormSelected Objects
<schema>.<object>Fully-qualified table or view name in the specified schema
.All existing tables & views that the revoking user can see, across all schemas
*All schemas the revoking user can see, removing access to all tables and views in those schemas now and in the future
<schema>All tables and views in the specified schema now and in the future
<object>Table or view in the default schema. If a schema exists with the same name, it will be used. To avoid this, specify the fully-qualified object name.

<schema reference>

The schema the permission applies to (with the ALL or CREATE forms). If the IN [SCHEMA] clause is omitted, the permission is removed from all schemas, both now and in the future. Wildcards are not permitted with the IN keyword.

<column list>

Optional comma-separated list of specific table columns to which access is being revoked; see Column-Level Security for details
The ALL permission corresponds to the native table_admin permission, which gives full read/write access as well as the additional permission either to ALTER and DROP the specified table or to CREATE, ALTER, & DROP all tables in the specified schema.

Examples

For example, to revoke full access on the network_config table from jsmith:
REVOKE All Permissions on Table from User Example
To revoke SELECT access on the network_config_history table from the analyst role:
REVOKE Read on Table from Role Example
To revoke full access on each of the tables & views within the example schema from the developer role:
REVOKE All Permissions on Current Tables/Views in Schema from Role Example
To revoke SELECT access on all schemas from the auditor role:
REVOKE Read on Schemas from Role Example
To revoke SELECT access on all current and future tables & views within the app_schema schema from the app_user role:
REVOKE Read on Schema from Role Example
To revoke full access on each of the schemas, tables, & views in the database individually from the dbadmin role:
REVOKE All Permissions on All Schemas/Tables/Views from Role Example

Row-Level Security Examples

To revoke SELECT access on an rx_order table for all orders placed since the year 2002 (as was granted in the row-level grant example), revoke all SELECT access:
REVOKE Row-Level Access Example

Column-Level Security Examples

To revoke SELECT access on the following columns of an rx_order table:
  • orderer’s social security number
REVOKE Obfuscated Column-Level Access Example
To revoke SELECT access on the following columns of an rx_order table:
  • masked version of the orderer’s social security number (last 4 digits)
  • name of the prescription ordered
REVOKE Masked Column-Level Access Example

REVOKE Credential Permission

Permissions on credentials that have been granted directly to users or roles can be revoked.
REVOKE Credential Permission Syntax
REVOKE Create Credential Permission Syntax

Examples

To revoke read access on the credential named auser_azure_active_dir_creds from the auser user:
REVOKE Credential Use Permission Example
To revoke administrative access on the credential from the auser user:
REVOKE Credential Administrative Permission Example

REVOKE Data Source Permission

Permissions on data sources that have been granted directly to users or roles can be revoked.
REVOKE Data Source Permission Syntax
REVOKE Create Data Source Permission Syntax

Examples

To revoke connect access on the data source named kin_ds from the auser user:
REVOKE Data Source Use Permission Example
To revoke administrative access on the data source named kin_ds_anon from the auser user:
REVOKE Data Source Administrative Permission Example

REVOKE Data Sink Permission

Permissions on data sinks that have been granted directly to users or roles can be revoked.
REVOKE Data Sink Permission Syntax
REVOKE Create Data Sink Permission Syntax

Examples

To revoke connect access on the data sink named kin_dsink from the auser user:
REVOKE Data Sink Use Permission Example
To revoke administrative access on the data sink named kin_dsink_http from the auser user:
REVOKE Data Sink Administrative Permission Example

REVOKE Directory Permission

Permissions on KiFS directories that have been granted directly to users or roles can be revoked.
REVOKE Directory Permission Syntax
REVOKE Create Directory Permission Syntax

Examples

To revoke read access on a directory named kdata from the kuser user:
REVOKE Directory Read Permission Example
To revoke write access on a directory named kdata from the kuser user:
REVOKE Directory Write Permission Example

REVOKE Function (UDF/UDTF) Permission

Permissions relating to UDFs/UDTFs and Python UDF function environments that have been granted directly to users or roles can be revoked.
REVOKE Function (UDF/UDTF) Permission Syntax
REVOKE Create Function (UDF/UDTF) Permission Syntax

Examples

To revoke execute on the udf_sos_py_proc UDF from udf_user:
REVOKE Function Execute Permission Example
To revoke administrative access on every existing & future UDF, as well as the ability to manage function environments, from udf_user:
REVOKE Function Administrative Permission Example

REVOKE Graph Permission

Permissions on graphs that have been granted directly to users or roles can be revoked.
REVOKE Graph Permission Syntax
REVOKE Create Graph Permission Syntax

Examples

To revoke query, match, solve, & show access on the graph named big_cities_graph from geo_user:
REVOKE Graph Permission Example

REVOKE Procedure Permission

Permissions relating to SQL procedures can be revoked from users or roles.
REVOKE Procedure Permission Syntax
REVOKE Create Procedure Permission Syntax

Examples

To revoke execute on the sqlp_weekly procedure from spuser:
REVOKE EXECUTE PROCEDURE Permission Example

REVOKE SQL-GPT Context Permission

Permissions on SQL-GPT contexts that have been granted directly to users or roles can be revoked.
REVOKE SQL-GPT Context Permission Syntax
REVOKE Create SQL-GPT Context Permission Syntax

Examples

To revoke read access on the SQL-GPT context named example.atc_ctx from the ctxuser user:
REVOKE SQL-GPT Context Permission Example

REVOKE Stream Permission

Permissions on streams that have been granted directly to users or roles can be revoked.
REVOKE Stream Permission Syntax
REVOKE Create Stream Permission Syntax

Examples

To revoke administrative access on the stream named kin_stream from the auser user:
REVOKE Stream Administrative Permission Example

SHOW SECURITY

For any one or more (or all) users and roles in the system, the following can be listed: In addition, permissions, roles, & resource groups will be listed recursively for the roles the specified users/roles have and the roles those roles have, etc. This allows the full set of permissions for a given user or role, both direct & inherited, to be viewed with one command.
SHOW SECURITY Syntax

Examples

To show the permissions, roles, resource groups, and default schema for user jsmith:
SHOW SECURITY FOR User Example
To show the permissions, roles, and resource groups for the analyst role:
SHOW SECURITY FOR Role Example
To show the permissions, roles, resource groups, and default schema for the anonymous user and the public role:
SHOW SECURITY FOR Multiple Users/Roles Example
To show all users & roles:
SHOW SECURITY FOR All Users/Roles Example

CHECK

Users (or the current user) can have their effective permissions checked, including:
  • Role assignments
  • Administrative permissions
  • Object-level access
A result of YES or NO will be returned, based on whether the given user has the specified permissions or not, either directly or through a role or administrative access. Row/Column-level permission information will be returned after the YES, if applicable.
CHECK PERMISSION Syntax
CHECK ROLE Syntax

Parameters

<permission>

Permission to verify for the given userSupported permissions include:
PermissionDescription
ADMIN | ALLApplicable to credential objects and tables (or views)
CONNECTApplicable to external data sources
DELETEApplicable to tables
EXECUTEApplicable to User-Defined Functions (UDFs) and SQL stored procedures
INSERTApplicable to tables
READApplicable to credential objects
SELECTApplicable to tables (or views)
SYSTEM ADMINSystem admin permission
SYSTEM CREATESystem create permission
SYSTEM MONITORSystem monitor permission
SYSTEM READSystem read permission
SYSTEM WRITESystem write permission
UPDATEApplicable to tables
USER ADMINUser admin permission

PERMISSION

Optional keyword for clarity

ON

Keyword for specifying the optional ON clause, which checks for the specified permission on the following target (and optional target type) given in this clause

<target type>

Optional keyword for specifying the object type of the target; may be necessary to disambiguate same-named objects of differing typesSupported target types include:
Target TypeDescription
CONTEXTSQL-GPT context object
CREDENTIALCredential object
DATA SINKExternal data source
DATA SOURCEExternal data source
DIRECTORYKiFS directory
FUNCTIONUser-Defined Function (UDF)
GRAPHGraph
PROCEDURESQL stored procedure
SCHEMASchema
STREAMStream
TABLETable (or view)

<target>

Name of the object to which the given user’s specified permission will be checked

<role>

Name of the role of which the given user’s membership will be checked

FOR <user>

Optional FOR clause, which checks whether the specified permission/role exists for the user given in this clause; if omitted, the current user will be checked

IF EXISTS

Optional error suppression clause, which causes the check to return No if any of the entities specified do not exist; without this clause, non-existent entities will return an error

Impersonation (Execute As…)

When logged into the database as one user, SQL commands can be run as a second user (that user can be impersonated). To do this, first log in to the database as an administrator, then switch to the second user, and finally, run the command. Afterwards, the original user can be reverted back to in order to execute commands as that administrator again; alternatively, an option can be specified to prevent switching back to the original user. The ability to impersonate other users is available through SQL, using the following commands:
Only a user with administrator privilege can impersonate another user, and only an administrator with a Kinetica database account. Any users who are mapped to Kinetica as administrators via external authentication will need to ensure that a corresponding Kinetica administrator account has been created for impersonation to succeed.Additionally, impersonation is only supported via ODBC/JDBC.

EXECUTE AS

During a SQL session, a user can execute subsequent commands as another user.
This command is only available through KiSQL or database clients configured with the Kinetica ODBC/JDBC driver.
EXECUTE AS Syntax
The WITH NO REVERT option prevents the impersonated user from switching back to the original user. This is useful in several cases, including:
  • An administrator needs to run a script as a user with specific permissions, but doesn’t want the script to be able to revert back to administrator privileges during its execution.
  • An application server connects to the database with its own credentials, but issues commands to the database on behalf of an application user. Again, there is a need to prevent the application user from reverting back to the application server’s database account and using those privileges to execute commands.

Example

To demonstrate the uses of EXECUTE AS USER, the following commands can be issued upon logging into the database as an administrator. First, verify the current user is admin:
Show Current User Example
Current User Output
Then, switch to a user auser and verify the session is now executing commands as that user:
Switch User Example
Show Switched User
Switched User Output
Accessing a database object that auser has permission for results in a successful outcome:
Query Accessible Table as Switched User Example
Output
Accessing an object that auser doesn’t have permission for results in an error:
Query Inaccessible Table as Switched User Example
Output
To switch back to the original user and verify the current identity, use the REVERT command:
Switch Back to Original User Example
Show Switched Back User
Switched Back User Output
Now, switch to auser using the WITH NO REVERT option:
Switch User without Reversion Example
Show Switched User
Switched User Output
Attempts to switch back to the administrator user will fail:
Attempt to Switch Back Example
Output
Verify the session is still executing commands as the auser user:
Show Current User
Current User Output

REVERT

After using EXECUTE AS or SET USER to switch to another user, the original user can be switched back to using the following command:
This command is only available through KiSQL or database clients configured with the Kinetica ODBC/JDBC driver.
REVERT Syntax
See the EXECUTE AS example for an example usage of REVERT.

SET USER

The SET USER (or SETUSER) command is simply an alias for the EXECUTE AS and REVERT commands.
This command is only available through KiSQL or database clients configured with the Kinetica ODBC/JDBC driver.
The following commands are equivalent for switching to another user:
SET USER Syntax
There is no ability to prevent reversion to the original user when using the SET USER command. To prevent reversion, see EXECUTE AS.
The following commands are equivalent for switching back to the original user:
Revert User Syntax