GitHub user dosubot[bot] edited a comment on the discussion: 关于电网拓扑数据导入
<!-- Answer -->
你的配置现在只差一个关键点就能导入成功:
你 struct.json 的 edges 里 field_mapping 必须写成:
```json
"field_mapping": { "from": "from", "to": "to" }
```
不能写成 { "from": "id", "to": "id" },否则 loader 会把 edge_connected_to.csv 的 id
列当作边属性导入,但 schema.groovy 的 edgeLabel 没有声明 id 属性,导致 “Invalid property 'id' for
edge label” 或 “主键字段 [id] 为空”
的报错。[官方文档说明](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/en/docs/quickstart/toolchain/hugegraph-loader.md#L705-L1064)
**逐条检查你的配置:**
- edge_connected_to.csv 的 header 必须是
id,from,to,label,source_label,target_label,且 from/to 必须和顶点 CSV 的 id
完全一致(无空格、无大小写问题、无空行)。
- struct.json 的 edges 里 field_mapping 只写 from/to,不要写 id。
- edgeLabel 的 .properties() 只包含 "source_label", "target_label",不要加 "id"。
- value_mapping 是平铺结构没问题。
- null_values 建议只保留 ["NULL", "null"],不要加 "",否则空字符串会被判定为 null。
**你只需要把 struct.json 里所有 edges 的 field_mapping 全部改成:**
```json
"field_mapping": { "from": "from", "to": "to" }
```
其他配置不用动,edge_connected_to.csv 的 id 列可以保留但 loader 不会导入它为边属性。
这样配置后,边就能正常导入且无报错,所有关系都能导入。[详细机制见官方FAQ](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/en/docs/guides/faq.md)
如果还有报错,请贴出 edge_connected_to.csv 的 header 和前几行原始数据,以及 struct.json 某个 edges
配置的完整内容,我可以帮你定位具体是哪一行或哪一列有问题。
<!-- Dosu Comment Footer -->
*To reply, just mention
[@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fhugegraph).*
---
Share context across your team and agents. Try
[Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fhugegraph).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fhugegraph#message_id=7a3bd0eb-c9fa-45ad-844b-67450e860320)
[](https://github.dosu.com/apache/hugegraph?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fhugegraph)
[](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fhugegraph)
GitHub link:
https://github.com/apache/hugegraph/discussions/2917#discussioncomment-15214285
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]