如何在oozie工作流程中使用sqoop存储maxValue(列)?

时间:2015-08-21 06:36:38

标签: sqoop oozie

我正在编写一个oozie工作流程,使用sqoop将数据从postgresql传输到hdfs。

我能够将数据传输到hdfs。但在我的sqoop查询中,我想要一个从postgresql获取数据的条件,其中id> max(id)(即新查询应该从我已经从postgresql处理的行之后获取数据。)

为此,我考虑从当前处理的数据中存储max(id)值。然后在我的下一个查询中使用此值作为参数来过滤已处理的数据。这种方法可以运作吗?<action name="RunSqoop"> <sqoop xmlns="uri:oozie:sqoop-action:0.2"> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <configuration> <property> <name>mapred.job.queue.name</name> <value>${queueName}</value> </property> </configuration> <arg>import</arg> <arg>--append</arg> <arg>--connect</arg> <arg>jdbc:postgresql://10.smthng.smthng/arg> <arg>--password</arg> <arg>MyPass</arg> <arg>--username</arg> <arg>usr</arg> <arg>--query</arg> <arg>SELECT * from table where id>${maxid} </arg> //wana do smthng like this, But how to store this maxid <arg>--null-string</arg> <arg>\\N</arg> <arg>--fields-terminated-by</arg> <arg>\t</arg> <arg>-m</arg> <arg>1</arg> <arg>--target-dir</arg> <arg>/ds/ghds</arg> </sqoop> <ok to="AlterTable"/> <error to="sendErrorEmail"/> </action>

有什么方法可以在oozie工作流程中使用sqoop从postgresql导入的列中存储最大值?请分享方式。

0 个答案:

没有答案
相关问题