A single physical table service unit enables metadata configuration for a single physical table in a business data source. You can develop an API to access the physical table data based on this service unit. This topic describes how to create a single physical table service unit.
Prerequisites
You have successfully created the service unit group. For more information, see Create a service project group.
When the data source type is HBase 0.9.4/1.1.x/1.2.1/2.x, ElasticSearch, or MongoDB, you must complete metadata creation. For more information, see Create metadata.
You need to purchase the row-level permission feature.
Limits
You can perform metadata configuration on a single physical table through the data source. For supported data sources, see DataService Studio supported data sources.
Some data sources support row-level permissions. For supported data sources, see DataService Studio supported data sources.
Permission policies
Both project administrators and developer users can create service units.
Step 1: select the service unit type
On the Dataphin home page, select Service > API Development from the top menu bar.
In the upper left corner, select the project, click the Service Unit in the left-side navigation pane. On the Service Unit page, click +New Service Unit.
In the New Service Unit dialog box, select Single Physical Table Service Unit.
Step 2: configure the single physical table service unit parameters
On the New Service Unit page, configure the basic information and unit fields of the service unit.
Service unit basic information configuration
Parameter
Description
Service Unit Name
The name of the service unit. The name must meet the following requirements:
Can only contain letters, numbers, and underscores (_).
Starts with a letter.
Length is between 4 and 64 characters.
Service Unit Group
Select an already created service unit group.
Mode
The mode is used to define whether the data read by the service unit comes from the development data source or the production data source. The modes include Basic and Dev-Prod modes:
Basic: After selecting the Basic mode, you can only select the production data source when the service unit reads data.
Dev-Prod: After selecting the Dev-Prod mode, you can select both development data source and production data source when the service unit reads data.
You can view whether your data source is a production data source or a development data source on the data source page.
Physical Data Table
You can filter physical tables based on the data source type and data source. You can also click Add Data Source to introduce a new business data source to create a service unit based on the new business data source. For supported data sources, see DataService Studio supported data sources.
Service Unit Description
Provide a brief description of the service unit. No more than 128 characters.
Max Return Count
The default maximum return count in Dataphin is 1000. The maximum limit is 10000.
It is used to define the number of records returned when querying data through the API to avoid excessive data in a single query causing Dataphin system memory overflow. If you need to query more data, you can modify the PageSize parameter value in the SDK of Invoke API to return more data when querying the API.
If a similar service unit already exists, Dataphin will automatically display its name. You can view the detailed information of the service unit in the service unit list. To continue creating a new service unit, click Continue To Create to proceed to the Configure Service Unit Fields page.
Configure service unit fields.
Parameter
Description
Service Unit Field Type
The supported field types include Double, Float, String, Date, Boolean, Int, Long, Short, Byte, BigDecimal, and Binary. You need to select the corresponding parameter type based on the field type in the business data table.
If the field type of the business data table is not within the range of selectable parameter types, it is recommended to choose String.
Service Unit Field
Support custom selection of some source table fields as service unit fields. New fields in the source table can also be added and selected during editing.
Configure the mapping of fields in the data source to field names in the service unit. You can customize the field names according to the business situation. The naming convention is as follows:
Can only contain letters, numbers, and underscores (_).
Starts with a letter.
Length is between 4 and 64 characters.
When editing a single physical table service unit, if the system determines that the source table field has been deleted, it supports deleting the service unit field. After submitting the configuration, when creating a new API referencing the service unit, the field will not be present, avoiding failure when invoking the API due to the absence of the source table field.
Service Unit Field Description
Provide a brief description of the service unit field.
After configuring the service unit fields, click Data Preview at the bottom to view the business data corresponding to the fields. Up to 1000 records can be returned.
Based on the selected physical data table, the system automatically parses the row-level permission information associated with the physical data table, including the row-level permission name, description, control fields, data source environment, associated tables, and associated fields. You can also perform the following operations:
Enable or Disable row-level permissions: Control the effective status of row-level permissions and whether the row-level permission list information is visible when viewing the service unit.
Create Row-Level Permission: The operator needs to have permission to create row-level permissions. Click to navigate to the row-level permission creation page in Management Hub > Permission Management to create a new row-level permission.
NoteThe data range returned by calling this API is controlled by row-level permissions. When row-level permissions are inconsistent, there will be differences in the data return results.
When the mode is Basic, the row-level permissions of the physical data table associated with the production environment are displayed. When the mode is Dev-Prod, the row-level permissions of the physical data table associated with both the development environment and production environment are displayed.
If the service unit has row-level permissions enabled and has been published, the APIs created under this service unit will be controlled by the corresponding row-level permissions when called.
When creating an API under a service unit with row-level permissions enabled and published, if you create or delete the row-level permissions associated with the service unit in Management Hub > Permission Management, the system will automatically enable or disable the row-level permissions without requiring you to republish the API.
The added physical table will be controlled by the row-level permissions associated with the physical table, regardless of whether the fields of the physical table are used by the API or added to the service unit.
Click Submit to complete the creation of the single physical table service unit.
What to do next
On the service unit page, click the Actions column
icon and select Publish to submit the single physical table service unit to the production environment. You can then create an API based on this single physical table service unit. For more information, see Create API.After the physical table service unit is created, you can edit, publish, or delete it on the service unit page. For more information, see Manage Service Units.