dataX-windows系统下mysql与txt的转化(二)

本文介绍了在Windows系统中,使用DataX将TXT文件转换到MySQL数据库的过程,包括文件准备、TXT到TXT的转换以及TXT数据导入MySQL的步骤和遇到的问题及解决方案。
摘要由CSDN通过智能技术生成

本篇的配置环境 https://www.jianshu.com/p/6c086c0ab2a9
mysql 8.0.27 ,python3.7 ,windows系统

一、文件准备

新建workJson 和 workfile 目录分别存放原始文件,和json
原始文件名file.txt分割符为\t
image.png

二、txt文件到txt文件

  • json模板获取
    python D:\dataxTest\datax\bin\datax.py -r txtfilereader -w txtwriter > txtTotxtfile.json
  • txtTotxt配置
{
   
    "job": {
   
        "content": [
            {
   
                "reader": {
   
                    "name": "txtfilereader",
                    "parameter": {
   
                        "column": [
                        {
   
                                "index": 0,
                                "type": "string",
                                "nullFormat":""
                            },
                            {
   
                                "index": 1,
                                "type": "string",
                                "nullFormat":""
                            },
                            {
   
                                "index": 2,
                                "type": "string",
                                "nullFormat":""
                            },
                            {
   
                                "index": 3,
                                "type": "string",
                                "nullFormat":""
                            }
                                  ],
                        "encoding": "utf-8",
                        "fieldDelimiter": "\t"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值