Alias Management
What are Aliases?
Aliases are the alternate common term used to name an item or a field inside a data source. Different data sources can have different names for the tables/items or for the attributes/fields that indicate a logically same item or field.
Eg: Datasource DS1 might have a table named ‘person’ and another datasource DS2 would have a table named ‘users’. Logically they both indicate the same entity. But since they have different names, I cannot fetch results from both the datasources using a single query.
So, in order to get a unified result from multiple datsources, Workspace Admins and Datasource Admins can map their items or fields down to a single term for getting the complete unified result from all the databases. Once a data source is created, aliases can be added to the items and fields inside it.
Note that in ShardOne, aliases are case insensitive, i.e. Person and person indicates the same Alias.
Types of Aliases
There are 2 types of aliases available
- Item Alias - Aliases that are mapped to items are referred to as Item Aliases.
- Field Alias - Aliases that are mapped to fields are called Field Aliases.
Item Aliases can only be mapped to items and cannot be mapped to fields. Likewise, Field Aliases cannot be mapped to items, and can only be mapped to fields.
View Aliases
The aliases added to the workspaces can be viewed in the Alias section. The aliases can be searched based on the Name, sorted on Name, Type & Datatype, and filtered by the Type, Datatype and Item Alias.
How to Map Aliases to Items?
Mapping aliases can be carried out by Workspace Admins or Datasource Admins. The steps for mapping item aliases are provided below:
- Navigate inside a datasource where all the items are listed.
- In the Alias column, a dropdown that lists the available Item Alias in the workspace can be found. Type in to search among the list.
- Select the alias to be added, further which the item will be mapped to the corresponding Entity Alias.
- If the alias that is typed does not exist, an option to create a new one will be visible. Click on the New Alias option to create it. This will have a new alias created under the workspace.
- An added alias can be removed by clicking on the ‘x’ button next to it. Note that the Alias will not be deleted from the workspace, it is just the mapping that would be removed. Note that on performing this, the respective fields under the item will also lose their mapping to Field Aliases if there were any.
How to Map Aliases to Fields?
Aliases can be assigned to fields by either a Workspace Admin or a Datasource Admin. ShardOne allows mapping Field Aliases to fields only if there is an Item Alias mapped to the corresponding item. ShardOne also restricts mapping a field alias to multiple fields under the same item. The steps to map field aliases are given below:
- Navigate inside an item with an Item Alias mapped, where all the fields are listed.
- In the Alias column, a dropdown that lists the available Field Alias under the corresponding Item Alias can be found. Type in to search among the list.
- In certain cases, specific aliases are deactivated. This is because the datatype of the alias is not compatible with the datatype of the field. For knowing more about Datatype Compatibility refere here.
- Select the alias that should be added. Subsequent to this selection, the field will be associated with the pertinent Field Alias.
- If the alias that is typed does not exist, an option to create a new one will be available. Click on the New Alias option to create it. A Field Alias with a corresponding datatype to that of the field gets created under the respective Item Alias.
- An added alias can be removed by clicking on the ‘x’ button next to it. Like the case in Item Alias, removing the Field Alias from a field does not result in the deletion of the Alias, but just implies to the mapping being deleted.
Edit an Alias
This operation could be performed by either a Workspace Admin or a Datasource Admin. Note that the queries that have reference to the previous name of the Alias is to be modified with the new name, so that desired results are yielded from the query. To edit an alias, be it Item Alias or Field Alias, follow these steps:
Navigate to the Alias tab, where all the aliases present in the workspace are listed.
Click on the Edit icon against the Alias record that needs to be edited.
- A pop-up will open up where the name of the Alias can be modified.
- On modifying, hit the ‘Update’ button which will initiate the updation of the Alias. The items/fields that were mapped to this Alias could now be referred with the updated name.
Delete an Alias
An alias could be deleted either by a Workspace Admin or a Datsource Admin. Deleting an Alias would imply to the permanent deletion of it in the workspace. Further, if it is an Item Alias that is being deleted, then all the Field Aliases under this would also get deleted automatically. The queries that use this Alias are also to be modified, as referencing an alias that no longer exists would lead to the query not fetching results. Find below the steps to be followed:
Navigate to the Alias tab, where all the aliases present in the workspace are listed.
Click on the Delete icon against the Alias record which should be deleted.
- If the alias is not mapped to any item/field, a confirmation pop-up to delete the alias will appear. Hit ‘Delete’ to delete the alias.
Else if the alias is mapped to any item or field, a warning pop-up with details of the mapping will appear.
For Item Alias - If the alias tried to be deleted is an Item Alias, then the confirmation pop-up would list the Items that the alias was mapped to and the Field Aliases and their mapped fields.
For Field Alias - If the alias tried to be deleted is a Field Alias, the confirmation pop-up would list the fields that were mapped to that Alias.
After checking the details, hit the ‘Delete’ icon to continue the process.
Deleting Aliases that are not mapped to any item or field is advised. In cases where they are mapped, it is recommended to either retain the mapping or remove it from items or fields. By following this practice, enhanced consistency can be achieved within the workspace.