Skip to main content

Using namespaces

Every TQL component exists in a namespace, which is used to assign privileges and control access. Every user account has a personal namespace with the same name. For example, the admin user has an admin namespace.

When you create an application in the console, by default it will be created in the current namespace, which is shown in the prompt (for example, W (admin) >). You can override that default by preceding CREATE APPLICATION with USE <namespace name>; to change the current namespace.

When you create an application in the UI, by default it will be created in your personal namespace. The "Create new application" dialog allows you to override the default by selecting a different namespace or creating a new one.

Note

When you import a TQL file in the UI, any CREATE NAMESPACE <name>; and USE <namespace name>; statements in the file will override the choice in the UI.

If useful, you may create an empty namespace:

CREATE NAMESPACE <name>;

One use for this is to keep applications that use components with the same names from interfering with each other. For example, you might have the current version of an application in one namespace and the next version in another.

Another use for a namespace is to hold a library of common types to be shared by various applications. For example:

CREATE NAMESPACE CommonTypes;
USE CommonTypes;
CREATE TYPE MerchantName(
  merchantId String KEY,
  companyName String
);
USE my_user_name;
CREATE APPLICATION PosMonitor;
CREATE STREAM MerchantNames OF CommonTypes.MerchantName;
...

The MerchantName type is now available in any application by specifying CommonTypes.MerchantName. The USE my_user_name command stops creation of components in the CommonTypes namespace. If you left that out, the PosMonitor application would be created in the CommonTypes namespace rather than in your personal namespace.

See Managing users, permissions, and roles for information on the role namespaces play in the Striim security model.