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
答案 0 :(得分: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( 选择c.YEARMONTH如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 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如d_enqhardtotalnum,a.ENQSOFTTOTALNUM如d_enqsofttotalnum,a.ENQHARDNUMMONTH如d_enqhardnummonth,a.ENQSOFTNUMMONTH如d_enqsoftnummonth,a.ENQTOTALNUM如d_enqtotalnum,a.ENQTOTALNUMMONTH如d_enqtotalnummonth, 'd_cug' 作为d_cug,a.CCACRWORSTEVER作为d_crworstever,一个。 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,a.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,一个。 CCANUMPAIDUPDEFACC为d_numpaidupdefacc,a.CCANUMSUSPENDEDACC为d_numsuspendedacc,a.CCANUMFROZENACC为d_numfrozenacc,d.SCORE为d_con_no,d.EXCLUSIONCODE为d_exclusion_code,'d_score_date'为d_score_date,来自dw.FT_CONSUMERSTATS a 内部联接dw.DM_CONSUMER作为b在a.CONSKEY = b.CONSKEY上,内联接dw.DM_MONTH作为c在c.MONTHKEY = a.MONTHKEY,内部联接dw.FT_CONSUMER_SCORE作为d在d.CONSKEY = b.CONSKEY,内部联接dw.DM_SUBURB as b on b.SUBURBKEY = e.SUBURBKEY where yearmonth = 201501 )t10其中\ $ 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 =整数,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 =整数
答案 1 :(得分:0)
在--query“ ....其中\ $ CONDITIONS AND yearmonth = 201501”