Create new schema

how to create new schema on CrateDB?

I tried with below command and got error.

CREATE SCHEMA test2 AUTHORIZATION testuser;

Error!

SQLParseException[line 1:8: no viable alternative at input ‘CREATE SCHEMA’]

In CrateDB you can just create a table within a schema like

CREATE TABLE schema_name.table_name

Also, you can grant rights like so on a schema (even if it doesn’t explicitly exists yet):

GRANT DQL ON SCHEMA schema_name TO user_name;

In CrateDB, schemas are just namespaces that are created and dropped implicitly. Therefore, when GRANT , DENY or REVOKE are invoked on a schema level, CrateDB takes the schema name provided without further validation.

2 Likes