# Source Model Management
After data source configuration, the next step is to standardize the data structure.
# Feature
It is used to define the structure of the read data.
# Type
Internal: Read data from internal data sources, with physical tables existed. If the table does not exist in the internal data source, it will be created automatically.
External: Read data from external data sources without creating tables. Users should ensure that there is a table existed in the external data source. If not, an error may occur if the table is required in later operations.
# Add Data Model
The data model depends on the data source, so first confirm the type of data source to be read and then create a data model correspondingly. Take the external data model as an example here (the internal data model is only for viewing historical data).
- Add new data model (for non-MySQL type, as MySQL type can be synchronized through data source detection). Select EXTERNAL, click New Data Model and fill in the required information.
- Data Source Name: Only external data sources are available for the external data model.
- Data Model Label: Set labels for the data model for classification.
- Description: Optional, to describe the data model in business.
After the data model is created, it will be displayed on the source model management page.
Click the created data model to edit fields (for non-MySQL type, as MySQL type can be synchronized through data source detection). The platform supports two editing modes: custom mode and SQL mode.
Custom mode
Select Custom Mode, click New Column to configure, and click OK to save the configuration.
Click New Index below to configure it if necessary.
**SQL mode (EXTERNAL) **
Define data model table structure in the SQL mode.
Select SQL Mode, enter the statement in the edit box and click Execute. If the execution result is successful, it means the creation is successful. If it fails, you can check the SQL error message in the log for troubleshooting. Here is an example:
create table if not exists member ( ID id , PROFILE3 keyword comment '', PROFILE19 keyword comment '', PHONE keyword comment '', PROFILE45 keyword comment '', PROFILE80 keyword comment '', OBJECTID keyword comment '', tagCode502_VALUE keyword comment '', primary key (id) )
Batch tagging is used to add labels to the selected data model in batches.
# Query Data Model
Select the data model type (INTERNAL or EXTERNAL).
Fill in the search criteria such as data source name, data model name, data model label and creation time to query.
# Ad Hoc Query
You can get the model data processed by workflow.
Go to Data Integration > Ad Hoc Query, select the model type and model name, click to copy the query statement and then click Execute to query.
If the queried model is not created by yourself, a prompt of no permission will appear.
To apply for permission, go to Data Governance > Workflow Table, enter the name of the model and click the icon to apply for authorization.
The submitted application can be viewed in Data Permission > Initiated by Me.
# Configure Fields
You can desensitize or encrypt the fields in the data model.