当前位置: 动力学知识库 > 问答 > 编程问答 >

sql - Sqoop and Multiline free form query

问题描述:

I'm trying to sqoop some data using a free form query, it's only that my queries are pretty long (several JOINs and PIVOT for several columns) and it's really messy to include within the Sqoop command itself. I know that I can create a .props file and put my query there. My file.props is of the form:

import

--connect

jdbc:oracle:thin:@hostname:port:sid

--username

user

--password

password1

--query

'SELECT col1, col2, ..., col18,"'pivotedcol1'", ..., "'pivotedcol21'"\

FROM (SELECT col1, ..., col18, DEFINITIONS,\

to_char(to_date(TIME),'DD.MM.YY', 'YYYY-MM-DD') \

FROM table1\

LEFT OUTER JOIN table2\

ON table2.colX = table1.colX\

LEFT OUTER JOIN table3\

ON table2.colY = table3.colX\

LEFT OUTER JOIN table4\

ON table4.colX = table1.colX\

LEFT OUTER JOIN table5\

ON table5.colX = table4.colY\

LEFT OUTER JOIN table6\

ON table5.colY = table6.colX\

LEFT OUTER JOIN table7\

ON table7.colX = table1.colX\

LEFT OUTER JOIN table8\

ON table7.colY = table8.colX\

WHERE ROWNUM <= 45000 AND $CONDITIONS)\

PIVOT (MAX(TIME) FOR DEFINITIONS IN ('pivotedcol1', ..., 'pivotedcol21'))'

--as-avrodatafile

--verbose

--target-dir

directory/freeform

After running

sqoop --options-file file.props

I get an error

ERROR sqoop.Sqoop: Error while expanding arguments java.lang.Exception: Multiline quoted strings not supported in file(file.props)

Where's mistake? Can I be doing something better?

分享给朋友:
您可能感兴趣的文章:
随机阅读: