解决datax处理csv文件时总是提示脏数据问题


此处为csv至mysql代码

{
    "job": {
        "content": [
            {
                "reader": {
                    "name": "txtfilereader", 
                    "parameter": {
                    "path": ["D:/file/test.csv"], 
                    "encoding":"gbk",
                        "column": [
                            {
                                "index": 0,
                                "type": "string"
                            },
                            {
                                "index": 1,
                                "type": "string"
                            },
                            {
                                "index": 2,
                                "type": "string"
                            },
                        ],
                    "fieldDelimiter":","
                    }
                }, 
                "writer": {
                    "name": "mysqlwriter", 
                    "parameter": {
                        "column": [
                        "id",
                        "name",
                        "age",
                        ], 
                        "connection": [
                            {
                                "jdbcUrl": "jdbc:mysql://localhost:3306/data?useUnicode=true&characterEncoding=utf8", 
                                "table": ["test2"]
                            }
                        ], 
                        "password": "root", 
                        "username": "root",
                        "writeMode":"insert"
                    }
                }
            }
        ], 
        "setting": {
            "speed": {
                "channel": "1"
            }
        }
    }
}

 

 截图所示,若我在此处 将type改为int类型 与mysql数据库中的数据类型对应,则会出现脏数据的提示并且插入失败,原因未找到。

解决方法就是全部改成string


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM