The process for publishing a schema is as follows:
Create a new schema definition
Upload the schema associated with the definition
Validate the schema
Publish the schema
Schema updates
After updating a schema, you can immediately use all its properties into the select part of your OTQL queries and any operator that doesn't require indexing.
If you add a new indexed property, only new elements going into your datamart will be indexed. You will be able to run WHERE queries and operators needing indexing, but your queries will not return values for elements already in your datamart. You can add a new indexed property by either adding a new property with @TreeIndex directive or adding the @TreeIndex directive to an existing property.
If you remove an indexed property, you will instantly stop being able to run WHERE queries and operators needing indexing for this query.
You can ask your mediarithmics contact to start a complete reindexing of your datamart if required
Manage schemas with mics CLI
You can use the MICS CLI to power up your schema definitions workflow.
Download a schema
Retrieve the LIVE schema or the specified one for a given datamart, and save it as a .gql file named schema-<DATAMARTID>-<SCHEMAID>.gql.
Use it to download the schema you want to start with, usually the current LIVE version.
If you want to show the schema in the output, use the --stdout flag.
Update a schema
Create a draft, upload a file, validate it, and publish the schema with this all-in-one command.
Creates a new DRAFT schema if there's no existing one without cloning.
Path Parameters
Name
Type
Description
datamartId
integer
The ID of the datamart
For the schema to keep initial settings—for example, elastic search version, and index size—you need to clone the previous LIVE version. Only use this endpoint if you know the required settings and you can set them up before publishing.
USAGE
$ mics-cli schema:fetch DATAMARTID [SCHEMAID]
ARGUMENTS
DATAMARTID the ID of the datamart
SCHEMAID [default: LIVE] the ID of the schema, or LIVE to get the live schema
OPTIONS
--stdout output the content of the file instead of saving it in a file
{
"status": "error",
"error": "Impossible to create a new schema, there is already one draft schema",
"error_code": "CONSTRAINT_VIOLATION_EXCEPTION",
"error_id": "690596a9-b0e0-43b3-88e8-b90d08b98029"
}
{
"status": "error",
"error": "Impossible to create a new schema, there is already one draft schema",
"error_code": "CONSTRAINT_VIOLATION_EXCEPTION",
"error_id": "690596a9-b0e0-43b3-88e8-b90d08b98029"
}
{
"status": "error",
"error": "2 error(s) found when validating schema : Type 'UserPoint' which is root of tree index 'USER_INDEX' requires a scalar field named 'creation_ts' to be annotated with '@TreeIndex(index:\"USER_INDEX\")' and to be typed 'Timestamp!', Type 'UserAccount' which is root of tree index 'USER_INDEX' requires a scalar field named 'compartment_id' to be annotated with '@TreeIndex(index:\"USER_INDEX\")' and to be typed 'String!'",
"error_code": "BAD_REQUEST_DATA",
"error_id": "6a52cea9-6de4-40f5-972e-a8480c268d19"
}
{
"status": "error",
"error": "Impossible to publish schema, validate the schema before a new publication",
"error_code": "BAD_REQUEST_DATA",
"error_id": "76e70020-02cb-40ec-8109-adf204aa0a7b"
}