Giter Site home page Giter Site logo

如何导数据到hive about datafaker HOT 9 OPEN

gangly avatar gangly commented on May 10, 2024
如何导数据到hive

from datafaker.

Comments (9)

gangly avatar gangly commented on May 10, 2024

有两种方式导入到hive:

  1. hive类型,hive版本支持ACID的,可以单条写入
  2. file类型,按照格式生成数据文件,然后上传文件到hdfs

from datafaker.

tulinying avatar tulinying commented on May 10, 2024

有两种方式导入到hive:

  1. hive类型,hive版本支持ACID的,可以单条写入
  2. file类型,按照格式生成数据文件,然后上传文件到hdfs

您好。 请问一下第2种形式是不是这种套路:datafaker rdb mysql+mysqldb://root:root@localhost:3600/test?charset=utf8 stu 10 --outprint --meta meta.txt --outspliter ',,' >> file

然后再把这个file扔到hive里?(不过我发现这样生成的文件是每行的头尾都有带[] 好像要处理了才能导入hive)
另第1种形式是什么意思?

from datafaker.

gangly avatar gangly commented on May 10, 2024

datafaker file /home out.txt 10 --meta meta.txt
请仔细阅读文档其他参数和使用举例

from datafaker.

tulinying avatar tulinying commented on May 10, 2024

额好吧,还有 我打印出来到屏幕上的数据是这个样子的~~
[1, u'OyBYxUtPDnBEHoW', u'\u65e7\u5927\u9662', u'\u9b3c\u6ce3', 52, 17, 63.41, u'15737968987', u'[email protected]', '192.88.21.168', u'\u5b81\u590f\u56de\u65cf\u81ea\u6cbb\u533a\u7389\u82f1\u5e02\u84df\u5dde\u4e1c\u839e\u8defX\u5ea7 730082']
[2, u'SPVQwwjbVzfJBtblXL', u'\u65e7\u5927\u9662', u'\u9017\u6bd4', 19, 20, 39.53, u'13044617779', u'[email protected]', '169.255.220.229', u'\u798f\u5efa\u7701\u6d69\u53bf\u5357\u6eaa\u798f\u5dde\u8deff\u5ea7 484055']

from datafaker.

gangly avatar gangly commented on May 10, 2024

直接写文件看看

from datafaker.

tulinying avatar tulinying commented on May 10, 2024

datafaker rdb mysql+mysqldb://user:password@localhost:3306/demo?charset=utf8 stu 10 --outprint --meta meta.txt --outspliter ',,' >result.dat

我的result.dat内容示例如下
[1, u'rYKLySNFRxZDuGc', u'\u732a\u573a', u'\u9017\u6bd4', 37, 74, 44.31, u'18195210203', u'[email protected]', '192.175.25.85', u'\u9ed1\u9f99\u6c5f\u7701\u6606\u660e\u53bf\u897f\u5cf0\u65b9
u8defx\u5ea7 547960']
[2, u'RKamsnXnjTtWYRql', u'\u6e05\u534e\u4e2d\u5b66', u'\u9017\u6bd4', 65, 33, 43.88, u'13304377714', u'[email protected]', '192.56.224.35', u'\u5b89\u5fbd\u7701\u96ea\u6885\u5e02\u6000\u67d4
u60e0\u5dde\u8857h\u5ea7 189080']

from datafaker.

tulinying avatar tulinying commented on May 10, 2024

另外我似乎有发现

datafaker rdb mysql+mysqldb://user:password@localhost:3306/demo?charset=utf8 stu 10 --outprint --meta meta.txt --outspliter ',,' >result.dat

当password长这个样子:
abcdEf$
我密码尾部有个$字符

此时会引起报错

from datafaker.

gangly avatar gangly commented on May 10, 2024

datafaker file /home out.txt 10 --meta meta.txt
用file命令写文件,应该是汉字

密码有特殊字符,我排查下问题

from datafaker.

tulinying avatar tulinying commented on May 10, 2024

好的 datafaker file /home out.txt 10 --meta meta.txt 学习了~ 谢谢 有效了。

from datafaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.