3.5.2 Importing custom table records

This section describes the [Import] tab of the Datamodel application.
On the [Import] tab, you can import records in bulk from a CSV file containing records of a custom table, for example when introducing Ops I, and create or update records.
In this section, jobs for importing records are referred to as import jobs. To use the [Import] tab, you must be assigned the Primitive role “resource_importer”.
In addition, to import records, you must register an Import YAML file in advance. For details about the Import YAML file, see “Import”.


(1) “Import job list” window

Clicking the [Import] tab displays the “Import job list” window.
In the “Import job list” window, you can check the import status and, if an error occurs, identify the row in the CSV file that caused the error.
Records of registered custom tables can be viewed from the [Custom Data Model] tab. For details, see “Custom data models”.

The “Import job list” window consists of the [Import] button, the [Delete] button, and the “Import job list”. The details are as follows.

(Table) Components of the “Import job list” window

Component Description
[Import] button Clicking this button displays the Upload File window.
For details, see "Upload File window".
[Delete] button Deletes import jobs.
This button is enabled when one or more items are selected using the checkboxes in the "Import job list". Clicking this button displays a deletion confirmation dialog box. In the deletion confirmation dialog box, select the [Confirmed] checkbox and click the [OK] button to delete the selected import jobs. Only import jobs with a status of "succeeded" or "error" can be deleted.
Import job list Details on import jobs are displayed in a list.
The following items are displayed:
  • Checkbox: Used to delete import jobs.
  • Job ID: Displays the ID of the import job.
  • Resource Type: Displays the type of the imported resource (group, role, customer, or custom-data).
    If the Primitive role "user_admin" is not assigned, only import jobs with a resource type of "custom-data" are displayed.
  • Import Name: Name of the import definition specified during import.
  • File Name: Displays the name of the uploaded CSV file.
  • Num Rows Imported: Displays the number of rows successfully imported.
  • Error Rows: Displays the number of rows that failed to be imported.
    Clicking this item downloads the CSV file containing the error results.
  • Total Rows: Displays the total number of rows, including both successfully imported rows and error rows.
  • Status: Displays the progress of the import.
    The following statuses are displayed:
    • accepted: Waiting for processing.
      The import job has been accepted by the system and is waiting to be processed.
    • processing: In progress.
      The import job is currently being processed. Each row in the CSV file is processed in sequence.
    • succeeded: Completed successfully.
      All records have been successfully imported.
    • error: Error.
      The import job has completed, but errors occurred in some rows. You can view details of the rows where errors occurred.
  • Created By: Displays the user who executed the import.
  • Created On: Displays the date and time when the import was executed (YYYY-MM-DD hh:mm:ss ±hh:mm)
  • Finished On: Displays the date and time when the import was completed (YYYY-MM-DD hh:mm:ss ±hh:mm)

(2) Upload File window

Clicking the [Import] button in the “Import job list” window displays the Upload File window.
In the Upload File window, you can import a custom table by specifying an Import Definition and uploading a file.

The Upload File window consists of the [Start import] button, the [Cancel] button, the Import Definition, and the file upload area. The details are as follows.

(Table) Components of the Upload File window

Component Description
[Start import] button Clicking this button imports the records in the CSV file uploaded in the file upload area in the format selected in the Import Definition. This button is disabled if no format is selected in the Import Definition or if no file has been uploaded to the file upload area.
[Cancel] button Clicking this button displays the "Import job list" window without executing the import.
Import Definition Selects an import definition.Search Clicking the icon displays the [Import Definition] dialog box. After selecting an import definition and clicking the [OK] button, the dialog box closes and the selected value is entered. The import definition displayed must be defined in advance in an Import YAML file. For the "name" or "label" label in the Import YAML file, set a name that clearly indicates the destination table for the import. For details, see "Importing records from custom tables".
File upload area Upload a CSV file containing records of the custom table to be imported.
Clicking the "select" link in "Drop or select a file to add" displays the file operation dialog box. To upload a CSV file, select it in the file operation dialog box or drop it into the dotted area. You cannot upload multiple CSV files simultaneously. You can upload a file that meets the following conditions:
  • The file size must be 100 MB or less.
  • The character encoding must be UTF-8 (without BOM).
If you select a CSV file exceeding 100 MB, an error message will be displayed and the import will not be performed.

In the CSV file, enter data items on the first line, separated by commas (,). From the second line onward, enter the values to be imported, separated by commas (,) and in the same order as on the first line.
When specifying multiple values for a single data item, separate the values with semicolons (;).

For importing records into a custom table, the behavior of the import varies depending on the conditions at the time of import.
If the CSV file is mapped to the custom table, the records in the CSV file are applied to the custom table.
If the CSV file is not mapped to the custom table, the records to be applied vary depending on the following conditions:

  • Whether the records are newly created or updated
  • Whether the columns are default Ops I columns or user-created columns

The combinations of the above conditions and the corresponding behavior are shown in the following table.

(Table) Behavior at the time of import

Record behavior*1 Default column?*2 Behavior
Newly created Yes The following values are set:
  • id, created_on, updated_on: Automatically set
  • created_by, updated_by: User who created the import job
  • sys_customer: null
No null is set. However, if the "not-null" label in the Datamodel YAML file is set to "true" for a column, an error occurs. If a default value is set, the default value is applied.
Updated Yes The following values are updated:
  • updated_on: Automatically updated
  • updated_by: User who updated the import job
id, created_on, created_by, and sys_customer are not updated.
No Not updated.
*1: For columns for which the "coalesce" label in the Import YAML file is set to "true", if a record with the same value as in the CSV file exists in the custom table, the record is updated. Otherwise, the record is newly created.
*2: Of the default columns, the following can be imported:
id, created_on, updated_on, created_by, updated_by, sys_customer

NotesNotes

In Ops I custom tables, the value of the "id" for each record must be unique within the table. However, when records that include "id" are imported, there is a risk that records with duplicate "id" values might be registered. When importing records that include "id", you can avoid this risk by setting only "id" as the unique identifier (coalesce: true).


TipsTips
When you import records obtained from an Ops I custom table into another Ops I, it is recommended to set "id" as the unique identifier (coalesce: true).
In other cases, it is recommended to set an appropriate record in the CSV file as the unique identifier and not to set "id" as the target in columnMappings. If "id" is not set as the target, a value that is unique within Ops I is automatically assigned to "id".

When records of a custom table are imported, the data format in the CSV file corresponding to the column types in the Datamodel YAML file is as follows. For details about the column types in the Datamodel YAML file, see “(Table) Column types”.

(Table) CSV file data formats corresponding to column types in the Datamodel YAML file

Datamodel YAML file column type CSV file data format
integer Integer
numeric Number with decimal point
varchar String
The default maximum length of a string is 40 characters. You can change the maximum length of a string by specifying "varchar(number of characters)". The maximum allowable string length is 10,485,760 characters.
text String
timestamp Format: YYYY-MM-DDThh:mm:ss±hh:mm
Example: 2026-01-05T14:30:00+09:00
date One of the following formats:
  • YYYY-MM-DD
  • YYYY-MM-DDThh:mm:ss±hh:mm
If entered in YYYY-MM-DDThh:mm:ss±hh:mm format, it is converted to YYYY-MM-DD format.
Example: 2026-01-05
time Format: hh:mm:ss
Example: 14:30:00
boolean true or false
enum Format defined in the Datamodel YAML file
inet Format: CIDR (IPv4)
Example: 192.168.1.1
decimal Number with decimal point
uuid Format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
"X" represents an alphanumeric character (a-f, 0-9).
Example: 550e8400-e29b-41d4-a716-446655440000
TipsTips
Use a uuid compliant with RFC9562 (versions 1-8).

<Specification examples>
The specification examples for a Datamodel YAML file, an Import YAML file, and a CSV file are as follows.

■Datamodel YAML file

---
apiVersion: 1.0
kind: datamodel

type: resource
name: device_request_datamodel
label: device_request_datamodel
description: device_request_datamodel

tables:
  - name: device_request_table
    label: device_request_table
    columns:
      - name: title
        label: Title
        type: varchar
      - name: device_type
        label: Device Type
        type: enum
        enum:
          - name: company_cell_phone
            label: Company Mobile Phone
          - name: tablet
            label: Tablet Device
          - name: note_pc
            label: Laptop PC
          - name: desktop_pc
            label: Desktop PC
      - name: num_request
        label: Quantity
        type: integer
        default: 1
      - name: request_date_time
        label: Request Date and Time
        type: timestamp
      - name: note
        label: Notes
        type: text

■ Import YAML file

---
apiVersion: 1.0
kind: import

type: resource
name: device_request_import
label: Device Request Data Import
description: Data import definition for device_request_table

includes:
  - kind: datamodel
    name: device_request_datamodel

# Target table name
targetTable: device_request_table

# Mapping between CSV columns and DB columns
columnMappings:
  # Unique identifier (key for searching existing records)
  - source: id
    target: id
    coalesce: true

  # Title (maximum 255 characters)
  - source: title
    target: title
    validation:
      format: regex
      pattern: ^.{1,255}$

  # Device type
  - source: device_type
    target: device_type

  # Request quantity (integer from 1 to 999)
  - source: num_request
    target: num_request
    validation:
      format: regex
      pattern: ^[1-9][0-9]{0,2}$

  # Request date and time (optional)
  - source: request_date_time
    target: request_date_time

  # Notes (optional, no validation)
  - source: note
    target: note

■ CSV file

id,title,device_type,num_request,request_date_time,note
550e8400-e29b-41d4-a716-446655440000,Request for a Laptop PC,note_pc,1,2026-02-10 09:00:00,A laptop PC for development is required
6ba7b810-9dad-11d1-80b4-00c04fd430c8,Request for Company Mobile Phones,company_cell_phone,2,2026-02-10 10:30:00,Two units for the sales department
7c9e6679-7425-40de-944b-e07fc1f90ae7,Request for Tablet Devices,tablet,3,2026-02-11 14:15:00,For on-site work
8f9e6679-8536-41ef-a55c-f18ed2f90bf8,Additional Request for Desktop PC,desktop_pc,1,2026-02-11 16:45:00,To accommodate increased staff in the design department