2017-03-23 126 views
1
sqoop import --connect 'jdbc:sybase:Tds:10.100.*.***:5500/DATABASE=****' --driver 'com.sybase.jdbc3.jdbc.SybDriver' --username "keswara" --password "****" --target-dir "/user/keswara/WT_CONSUMERSTATS" --verbose --query "select c.YEARMONTH as d_stat_yearmonth,b.CONSNO,a.CONSCURRJDGMNTNUM as d_conscurrjdgmntnum,a.CONSCURRDFLTNUM as d_conscurrdfltnum,a.CONSCURRNOTICENUM as d_conscurrnoticenum,a.CONSCURRNOTRLBONDNUM as d_conscurrnotrlbondnum,a.CONSCURRDFLTADMINNUM as d_conscurrdfltadminnum,a.AMNISTYIND as d_amnisty_ind,a.NCRCREDITACTIVE as d_ncr_credit_active_ind,b.ACTIVEIND as d_active_ind,a.ESTINCOME as d_income,'d_create_date' as d_create_date,e.SUBURBCODE as d_physaddrsuburb_code, 
    a.ENQHARDTOTALNUM as d_enqhardtotalnum,a.ENQSOFTTOTALNUM as d_enqsofttotalnum,a.ENQHARDNUMMONTH as d_enqhardnummonth,a.ENQSOFTNUMMONTH as d_enqsoftnummonth,a.ENQTOTALNUM as d_enqtotalnum,a.ENQTOTALNUMMONTH as d_enqtotalnummonth,'d_cug' as d_cug,a.CCACRWORSTEVER as d_crworstever,a.CCAINSWORSTEVER as d_insworstever,a.CCACRWORSTEVER as d_worstever,a.CCANUMACC as d_numacc,a.CCANUMOPENACC as d_numopenacc,a.CCANUMCLOSEDACC as d_numclosedacc,a.CCANUMNEGCLOSEDACC as d_numnegclosedacc,a.CCANUMPOSCLOSEDACC as d_numposclosedacc,a.CCANUMACTIVEACC as d_numactiveacc,a.CCANUMWRITEOFFS as d_numwriteoffs,a.CCANUMDECEASEDWRITEOFFS as d_numdeceasedwriteoffs, 
a.CCANUMHANDEDOVER as d_numhandedover,a.CCANUMCRCARDREVOKE as d_numcrcardrevoke,a.CCANUMREPO as d_numrepo,a.CCATOTALINSTALMENTAMT as d_totalinstalmentamt,a.CCATOTALOPENBAL as d_totalopenbal,a.CCATOTALCURRBAL as d_totalcurrbal,a.CCATOTALOVDUECRAMT as d_totalovduecramt,a.CCATOTALOVDUEDRAMT as d_totalovduedramt,a.CCANUMPAIDUPDEFACC as d_numpaidupdefacc,a.CCANUMSUSPENDEDACC as d_numsuspendedacc,a.CCANUMFROZENACC as d_numfrozenacc,d.SCORE as d_con_no,d.EXCLUSIONCODE as d_exclusion_code,'d_score_date' as d_score_date from dw.FT_CONSUMERSTATS a 
inner join dw.DM_CONSUMER as b on a.CONSKEY = b.CONSKEY,inner join dw.DM_MONTH as c on c.MONTHKEY = a.MONTHKEY,inner join dw.FT_CONSUMER_SCORE as d on d.CONSKEY = b.CONSKEY,inner join dw.DM_SUBURB as e on b.SUBURBKEY = e.SUBURBKEY where yearmonth = 201501 AND \$CONDITIONS" --split-by 1 --verbose --create-hive-table --hive-table wt_consumer_stats --hive-import --map-column-hive d_stat_yearmonth=integer,d_con_no=integer,d_conscurrjdgmntnum=integer,d_conscurrdfltnum=integer,d_conscurrnoticenum=integer,d_conscurrnotrlbondnum=integer,d_conscurrdfltadminnum=integer,d_amnisty_ind=string,d_ncr_credit_active_ind=string,d_active_ind=string,d_income=integer,d_create_date=datetime,d_physaddrsuburb_code=integer,d_enqhardtotalnum=integer,d_enqsofttotalnum=integer, 
d_enqhardnummonth=integer,d_enqsoftnummonth=integer,d_enqtotalnum=integer,d_enqtotalnummonth=integer,d_cug=string,d_crworstever=string,d_insworstever=string,d_worstever=string,d_numacc=integer,d_numopenacc=integer,d_numclosedacc=integer,d_numnegclosedacc=integer,d_numposclosedacc=integer,d_numactiveacc=integer,d_numwriteoffs=integer,d_numdeceasedwriteoffs=integer,d_numhandedover=integer,d_numcrcardrevoke=integer,d_numrepo=integer,d_totalinstalmentamt=decimal,d_totalopenbal=decimal,d_totalcurrbal=decimal,d_totalovduecramt=decimal,d_totalovduedramt=decimal,d_numpaidupdefacc=integer,d_numsuspendedacc=integer,d_numfrozenacc=integer,d_score_version=string,d_score=integer,d_exclusion_code=string,d_score_date=integer 
+1

這裏有什麼問題?在這裏只發布命令的相關部分... – franklinsijo

+0

當我運行這個腳本時...''查詢必須包含'$ CONDITIONS'在where子句「!!!這是個問題!:) – karthee

+0

但@ karthee你的'sqoop'命令已經包含了'$ CONDITIONS',你仍然得到錯誤或者需要解釋爲什麼需要它嗎? – franklinsijo

回答

1

你試過類似的東西嗎?

sqoop import --connect'jdbc:sybase:Tds:10.100。*。***:5500/DATABASE = ****'--driver'com.sybase.jdbc3.jdbc.SybDriver'--username 「keswara」--password「****」--target-dir「/ user/keswara/WT_CONSUMERSTATS」--verbose --query「select * from( select c.YEARMONTH as d_stat_yearmonth,b.CONSNO,a。 CONSCURRJDGMNTNUM爲d_conscurrjdgmntnum,a.CONSCURRDFLTNUM爲d_conscurrdfltnum,a.CONSCURRNOTICENUM爲d_conscurrnoticenum,a.CONSCURRNOTRLBONDNUM爲d_conscurrnotrlbondnum,a.CONSCURRDFLTADMINNUM爲d_conscurrdfltadminnum,a.AMNISTYIND爲d_amnisty_ind,a.NCRCREDITACTIVE爲d_ncr_credit_active_ind,b.ACTIVEIND爲d_active_ind,a.ESTINCOME作爲d_income,'d_create_date'爲d_create_date,e.SUBURBCODE爲d_physaddrsuburb_code, a.ENQHARDTOTALNUM as d_enqhardtotalnum,a.ENQSOFTTOTALNUM as d_enqsofttotalnum,a.ENQHARDNUMMONTH as d_enqhar dnummonth,a.ENQSOFTNUMMONTH如d_enqsoftnummonth,a.ENQTOTALNUM如d_enqtotalnum,a.ENQTOTALNUMMONTH如d_enqtotalnummonth, 'd_cug' 作爲d_cug,a.CCACRWORSTEVER如d_crworstever,a.CCAINSWORSTEVER如d_insworstever,a.CCACRWORSTEVER如d_worstever,a.CCANUMACC如d_numacc, a.CCANUMOPENACC如d_numopenacc,a.CCANUMCLOSEDACC如d_numclosedacc,a.CCANUMNEGCLOSEDACC如d_numnegclosedacc,a.CCANUMPOSCLOSEDACC如d_numposclosedacc,a.CCANUMACTIVEACC如d_numactiveacc,a.CCANUMWRITEOFFS如d_numwriteoffs,a.CCANUMDECEASEDWRITEOFFS如d_numdeceasedwriteoffs, a.CCANUMHANDEDOVER作爲d_numhandedover,一個.CCANUMCRCARDREVOKE如d_numcrcardrevoke,a.CCANUMREPO如d_numrepo,a.CCATOTALINSTALMENTAMT如d_totalinstalmentamt,a.CCATOTALOPENBAL如d_totalopenbal,a.CCATOTALCURRBAL如d_totalcurrbal,a.CCATOTALOVDUECRAMT如d_totalovduecramt,a.CCATOTALOVDUEDRAMT如d_totalovduedramt,a.CCANUMPAIDUPDEFACC如d_numpaidupdefacc,a.CCANUMSUSPENDEDACC作爲d_numsuspendedacc,a.CCANUMFROZENACC作爲d_numfrozena cc,d.SCORE as d_con_no,d.EXCLUSIONCODE as d_exclusion_code,'d_score_date'as d_score_date from dw.FT_CONSUMERSTATS a inner join dw.DM_CONSUMER as b on a.CONSKEY = b.CONSKEY,inner join dw.DM_MONTH as c on c .MONTHKEY = a.MONTHKEY,inner join dw.FT_CONSUMER_SCORE as d on d.CONSKEY = b.CONSKEY,inner join dw.DM_SUBURB as e。b.SUBURBKEY = e.SUBURBKEY where yearmonth = 201501 )t10 where \ $ CONDITIONS「 --split-by 1 --verbose --create-hive-table --hive-table wt_consumer_stats --hive-import --map-column-hive d_stat_yearmonth =整數,d_con_no =整數,d_conscurrjdgmntnum =整數,d_conscurrdfltnum =整數, d_conscurrnoticenum =整數,d_conscurrnotrlbondnum =整數,d_conscurrdfltadminnum =整數,d_amnisty_ind =串,d_ncr_credit_active_ind =串,d_active_ind =串,d_income =整數,d_create_date =日期時間,d_physaddrsuburb_code =整數,d_enqhardtotalnum =整數,d_enqsofttotalnum =整數, d_enqhardnummonth =整數,d_enqsoftnummonth =整數,d_enqtotalnum =整數,d_enqtotalnummonth =整數,d_cug =串,d_crworstever =串,d_insworstever =串,d_worstever =串,d_numacc =整數,d_numopenacc =整數,d_numclosedacc =整數,d_numnegclosedacc =整數,d_numposclosedacc =整數, d_numactiveacc =整數,d_numwriteoffs =整數,d_numdeceasedwriteoffs =整數,d_numhandedover =整數,d_numcrcardrevoke =整數,d_numrepo =整數,d_totalinstalmentamt =十進制,d_totalopenbal =十進制,d_totalcurrbal =十進制,d_totalovduecramt =十進制,d_totalovduedramt =十進制,d_numpaidupdefacc =整數,d_numsuspendedacc =整數,d_numfrozenacc =整數,d_score_version =字符串,d_score =整數,d_exclusion_code =字符串,d_score_date =整數

+0

感謝您的回覆。但它也不幫助我!我得到了同樣的錯誤! – karthee

+0

我只是編輯命令,再試一次,讓我知道。 – hlagos

+0

它像一個魅力工作!桌子非常大......完成需要數小時!謝謝!腳本中的t10是什麼?它有什麼作用? – karthee