FairCom includes a new table in the faircom database called label_records. It is a bridge table that connects a record to a label. It can link any record in any table to one or more labels.
{
"api": "db",
"action": "createTable",
"params": {
"tableName": "label_records",
"primaryKeyFields": [
"source_database",
"source_owner",
"source_table",
"source_id",
"group",
"label"
],
"fields": [
{
"name": "source_database",
"type": "varchar",
"length": 64
},
{
"name": "source_owner",
"type": "varchar",
"length": 64
},
{
"name": "source_table",
"type": "varchar",
"length": 64
},
{
"name": "source_id",
"type": "bigint",
"length": 64
},
{
"name": "group",
"type": "varchar",
"length": 64
},
{
"name": "label",
"type": "varchar",
"length": 64
}
]
},
"authToken": ""
}
The label_records table has the following indexes
pk index
The pk index is created when the table is created. Its purpose is to ensure that each record's natural key is unique. In other words, it ensures only one record in the label_records table links a specific label to a specific record in a source table.
label_records_group index
The label_records_group index lets you search for records linked to a group of labels. You can specify the complete table name for an exact match to return all labels linked to the table. You can provide a partial table name to return all labels linked to multiple tables that match the partial name.
Returned records may be from multiple tables.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_group",
"fields": [
{
"name": "group"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}
label_records_label index
The label_records_label index lets you search for records linked to a label name regardless of which group the label belongs to. Returned records may be from multiple tables.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_label",
"fields": [
{
"name": "label"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}
label_records_group_label index
The label_records_label index lets you search for records linked to a specific label identified by its group name and label name. Returned records may be from multiple tables.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_group_label",
"fields": [
{
"name": "group"
},
{
"name": "label"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}
label_records_database_owner_table index
The label_records_database_owner_table index lets you search in specific tables for records linked to labels. You must specify the full database and owner names. You can specify the complete table name for an exact match to return all labels linked to the table. You can provide a partial table name to return all records in matching tables that have a group and label linked to them.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_database_owner_table",
"fields": [
{
"name": "database"
},
{
"name": "owner"
},
{
"name": "table"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}
label_records_database_owner_table_group index
The label_records_database_owner_table_group index lets you search in one specific table for records linked to labels. You must specify the full database, owner, and table names. You may specify the complete group name to return all records in the specified table that have labels in the specific group. You may specify a partial group name to return all records in the specified table that match the partial group name.
Note A user can create hierarchical group names by using a character, such as slash, to separate the name into parts. A partial match allows the user to search inside the hierarchy.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_database_owner_table_group",
"fields": [
{
"name": "database"
},
{
"name": "owner"
},
{
"name": "table"
},
{
"name": "group"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}
label_records_database_owner_table_group_label index
The label_records_database_owner_table_group_label index lets you search in one specific table and group for records linked to labels. This index is used the most. You must specify the full database, owner, table, and group names. You may specify the complete label name to return all records in the specified table that have the specified label. You may specify a partial label name to return all records in the specified table that match the partial label name.
Note A user can create hierarchical label names by using a character, such as slash, to separate the name into parts. A partial match allows the user to search inside the hierarchy.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_database_owner_table_group_label",
"fields": [
{
"name": "database"
},
{
"name": "owner"
},
{
"name": "table"
},
{
"name": "group"
},
{
"name": "label"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}
label_records_database_owner_table_label index
The label_records_database_owner_table_label index lets you search in one specific table for records linked to specific labels. The index ignores the group name; thus, it matches labels that are in multiple groups. You must specify the full database, owner, and table names. You may specify the complete label name to return all records in the specified table that have the specified label. You may specify a partial label name to return all records in the specified table that match the partial label name.
Note A user can create hierarchical label names by using a character, such as slash, to separate the name into parts. A partial match allows the user to search inside the hierarchy.
{
"api": "db",
"action": "createIndex",
"params": {
"tableName": "label_records",
"indexName": "label_records_database_owner_table_group_label",
"fields": [
{
"name": "database"
},
{
"name": "owner"
},
{
"name": "table"
},
{
"name": "label"
}
],
"waitToBeLoaded": true
},
"authToken": ""
}