来自CSV DateTime的OrientDB ETL

时间:2016-08-22 09:18:30

标签: csv orientdb etl

这是我目前的配置文件



{
	"config": {
		"haltOnError": false
	},
	"source": {
		"file": {
			"path": "/home/user1/temp/real_user/user3.csv"
		}
	},
	"extractor": {
		"csv": {
			"columns": ["id", "name", "token", "username", "password", "created", "updated", "enabled", "is_admin", "is_banned", "userAvatar"],
			"columnsOnFirstLine": true
		},
		"field": {
			"fieldName": "created",
			"expression": "created.asDateTime()"
		}
	},
	"transformers": [{
		"vertex": {
			"class": "user"
		}
	}],
	"loader": {
		"orientdb": {
			"dbURL": "plocal:/home/user1/orientdb/real_user",
			"dbAutoCreateProperties": true,
			"dbType": "graph",
			"classes": [{
				"name": "user",
				"extends": "V"
			}],
			"indexes": [{
				"class": "user",
				"fields": ["id:long"],
				"type": "UNIQUE"
			}]
		}
	}
}




我的csv目前看起来像这样

6,Olivia Ong,2jkjkl54k5jklj5k4j5k4jkkkjjkj,\N,\N,2013-11-15 16:36:33,2013-11-15 16:36:33,1,0,\N,\N
7,Matthew,32kj4h3kjh44hjk3hk43hkhhkjhasd,\N,\N,2013-11-18 17:29:13,2013-11-15 16:36:33,1,0,\N,\N

我仍然想知道当我执行ETL时,orientdb不会将我的日期时间识别为日期时间。

我尝试将数据类型放在列字段中" created:datetime",但它最终没有显示任何数据。

我想知道这种情况的正确解决办法是什么。

1 个答案:

答案 0 :(得分:1)

从下一版本2.2.8开始,您将能够为日期和日期时间定义不同的默认模式:CSV extractor documentation

请注意,在定义列时,需要指定列的类型:

            "columns": ["id:string", "created:date", "updated:datetime"],

您可以使用2.2.8 ETL模块和2.2.7的快照jar,没有任何问题:

https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/orientdb-etl/2.2.8-SNAPSHOT/