Source: https://dev-docs.nebula-graph.io/v5.3.2/utilities/exchange/config/sources/mapping/ Documentation version: v5.3.2 # Mapping configurations This topic describes the mapping configurations when importing data into NebulaGraph Database Developer Edition, which include node mapping configurations and edge mapping configurations. ## Node mapping configurations The node mapping configurations are specified in the section `sources.nodetypes` of the configuration file. ### Sample configuration ```` sources: [ { // type:"hdfs" // format:"csv" // header:false // separator:"," // path: "hdfs://127.0.0.1:9000/import_movie/sub_movie.csv" nodetypes: [ { name: "movie" sourceFields:[movieid, name] nebulaFields:[id, name] batchSize: 1000 enableRealTimeQPSLog: true mode: "INSERT IGNORE" } ] edgetypes: [] } ] ```` ### Configuration options | Option | Description | Type | Required | Default value | `name` | The name of the node type in the graph to which data is written. | String | Yes | N/A | `sourceFields` | The list of names of fields in the data source. The values of these fields are written as values of the properties of the node type. When importing data from NebulaGraph 3.x, set `sourceFields` to the list of names of properties from which data is retrieved. Besides, you can also specify `_vertexId` to retrieve vertex IDs; specify `_srcId`, `_dstId`, and `_rank` to retrieve source vertex IDs, destination vertex IDs, and ranks of edges respectively. | List | Yes | N/A | `nebulaFields` | The list of names of properties of the node type. The order of the property names must correspond to the order of the field names in `sourceFields`. | List | Yes | N/A For details on the supported data types of the properties in `nebulaFields` and the format requirements on fields in `sourceFields` by special data types, see [Supported data types](https://dev-docs.nebula-graph.io/v5.3.2/utilities/exchange/config/sources/mapping/#supported_data_types). #### Common write configurations The following configuration options can also be specified as global settings in the section `writeCommon` of the configuration file: `batchSize`, `enableRealTimeQPSLog`, and `mode`. Note that the configurations on specific node types override the global settings. For more information about their descriptions, see [Common write configurations](https://dev-docs.nebula-graph.io/v5.3.2/utilities/exchange/config/#common_write_configurations). ## Edge mapping configurations The edge mapping configurations are specified in the section `sources.edgetypes` of the configuration file. ### Sample configuration ```` sources: [ { // type:"hdfs" // format:"csv" // header:false // separator:"," // path: "hdfs://127.0.0.1:9000/import_movie/sub_user_watched_movies.csv" nodetypes: [ ] edgetypes: [ { name: "watch" sourceKeys: [userid] nebulaSrcKeys: [id] targetKeys: [movieid] nebulaDstKeys: [id] sourceFields:[rate] nebulaFields:[rate] batchSize: 1000 enableRealTimeQPSLog: true mode: "INSERT IGNORE" ignoreHangingEdge: false } ] } ] ```` ### Configuration options | Option | Description | Type | Required | Default value | `name` | The name of the edge type in the graph to which data is written. | String | Yes | N/A | `sourceKeys` | The list of fields in the data source mapped as the primary key of the source node type of the edge type. | List | Yes | N/A | `nebulaSrcKeys` | The list of names of properties that serve as the primary key of the source node type of the edge type. The order of the property names must correspond to the order of the field names in `sourceKeys`. This option is optional if the primary key of the source node type consists of only one property. | List | No | N/A | `targetKeys` | The list of fields in the data source mapped as the primary key of the destination node type of the edge type. | List | Yes | N/A | `nebulaDstKeys` | The list of names of properties that serve as the primary key of the destination node type of the edge type. The order of the property names must correspond to the order of the field names in `targetKeys`. This option is optional if the primary key of the destination node type consists of only one property. | List | No | N/A | `sourceFields` | The list of names of fields in the data source. The values of these fields are written as values of the properties of the edge type. When importing data from NebulaGraph 3.x, set `sourceFields` to the list of names of properties from which data is retrieved. Besides, you can also specify `_vertexId` to retrieve vertex IDs; specify `_srcId`, `_dstId`, and `_rank` to retrieve source vertex IDs, destination vertex IDs, and ranks of edges respectively. | List | No | N/A | `nebulaFields` | The list of names of properties of the edge type. The order of the property names must correspond to the order of the field names in `sourceFields`. | List | No | N/A | `ignoreHangingEdge` | Whether to ignore edges that do not connect to nodes on either or both sides, known as dangling edges. Options: `true`: No error is reported. The write operation for a dangling edge is ignored, but it is still counted as a successful write. `false`: An error is reported. The write operation for a dangling edge fails. | Bool | No | `false` For details on the supported data types of the properties in `nebulaSrcKeys`,`nebulaDstKeys`, and `nebulaFields`, as well as the format requirements on fields in `sourceKeys`, `targetKeys` and `sourceFields` by special data types, see [Supported data types](https://dev-docs.nebula-graph.io/v5.3.2/utilities/exchange/config/sources/mapping/#supported_data_types). #### Common write configurations The following configuration options can also be specified as global settings in the section `writeCommon` of the configuration file: `batchSize`, `enableRealTimeQPSLog`, `mode`, and `ignoreHangingEdge`. Note that the configurations on specific edge types override the global settings. For more information about their descriptions, see [Common write configurations](https://dev-docs.nebula-graph.io/v5.3.2/utilities/exchange/config/#common_write_configurations). ## Supported data types NebulaGraph Exchange supports mapping source data to properties of the following data types: | Data type | Description | [Numeric](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/numeric-type/) | Includes `INT`, `DOUBLE`, `FLOAT`, and `DECIMAL`. | [String](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/c-string-type/) | Includes `STRING`. | [Boolean](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/boolean-type/) | Includes `BOOL`. | [Date and time](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/temporal-type/) | Includes `DATE`, `DURATION`, `LOCAL DATETIME`, `LOCAL TIME`, `ZONED DATETIME`, and `ZONED TIME`. | [List](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/list-type/) | `LIST`, where `E` can be `INT`, `DOUBLE`, `FLOAT`, `STRING`, or `BOOL`. Import format: Starts with `[` and ends with `]`, without the `LIST` prefix. Elements are separated by commas. For example: `[1, 2, 3]` or `["1", "2", "3"]`. | [Set](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/set-type/) | `SET`, where `E` can be any predefined data type or constructed data type other than records and paths. Import format: Starts with `{` and ends with `}`, without the `SET` prefix. Elements are separated by commas. For example: `{1, 2, 3}`. | [Map](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/map-type/) | `MAP`, where keys and values can be any predefined data type or constructed data type other than records and paths. Import format: Starts with `{` and ends with `}`, without the `MAP` prefix. Uses `key:value` pairs separated by commas. For example: `{'a':123,'b':true}`. | [Vector](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/vector-type/) | `VECTOR`, where `n` is the number of dimensions, ranging from 1 to 2,147,483,647. Import format: Starts with `[` and ends with `]`, without the `VECTOR` prefix. Elements must be numeric values without quotes, and the number of elements must be consistent across rows. For example: `[1.0, 2.0, 3.0]`. | [Geospatial](https://dev-docs.nebula-graph.io/v5.3.2/database-gql-reference/data-types/geo-type/) | Includes `POINT`, `LINESTRING`, and `POLYGON`. Values must be in WKT format. For example: `POINT(37.7749 -12.4194)`, `LINESTRING(1 2, 2 4, 4 8)`, `POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))`.