gpt4 book ai didi

mysql - 如何使用sqoop将hive数据导出到mysql的指定字段?

转载 作者:行者123 更新时间:2023-11-29 10:54:23 27 4
gpt4 key购买 nike

我在hdfs中有field1,field2,field3,在mysql表中有id(自动增量),field1,field2,field3,uptate_time(默认CURRENT_TIMESTAMP),我想要将hdfs中的三个字段导出到mysql表,该表有五个字段,其中两个字段具有默认值。如何在sqoop中实现这个?

最佳答案

使用--columns "<comma separated column names>"导出到选定的列。

根据 sqoop docs在表29中,

You can select a subset of columns and control their ordering by using the --columns argument. This should include a comma-delimited list of columns to export. For example: --columns "col1,col2,col3". Note that columns that are not included in the --columns parameter need to have either defined default value or allow NULL values. Otherwise your database will reject the imported data which in turn will make Sqoop job fail.

关于mysql - 如何使用sqoop将hive数据导出到mysql的指定字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43230073/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com