Created 06-07-2016 08:45 PM
Is there a way to make sqoop accept / characters in table and field names?
I have tried the following:
leaving the name as-is: --table /BI0/TCUSTOMER
wrapping in quotes: --table "/BI0/TCUSTOMER"
escaping each /: --table "\/BI0\/TCUSTOMER"
It produces this error each time for all three options above:
com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "\": line 1 col 17 (at pos 17)
Created 06-08-2016 09:31 PM
So it seems that SAP JDBC error is gone but somehow sqoop is not resolving the double quotes. Will do search locally and get back to you.
Created 06-13-2016 06:21 PM
Any updates on this?
Created 06-14-2016 10:15 PM
Sorry didn't get cycle to work on this. I will try it in couple of days. Also lets wait if other experts comment on this.
Created 06-07-2016 09:32 PM
That still doesn't work.
Here's my script:
sqoop --options-file options.txt \
--table "SCHEMA\".\"/BI0/TCUSTOMER"
--hive-import
--hive-overwrite
--split-by CUSTOMER
--hive-database DATABASE
Produces this error:
com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "/": line 1 col 26 (at pos 26)
Created 06-09-2016 12:40 AM
Can you try it with backqoutes? Something like this - \`tablename\`
Created 06-09-2016 01:18 PM
I tried that and got this error:
ERROR manager.SqlManager: Error executing statement: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "AS": line 1 col 19 (at pos 19) com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "AS": line 1 col 19 (at pos 19)
Created 07-08-2016 11:38 AM
I can confirm what @Josh Persinger is saying. The only way to get tables with forward slashes ('/') (and actually colons too) in the tablename from SAP into hadoop hdfs/hive is by using the --query statement.
Some other things I found out when importing from SAP HANA:
eg: \"/SOMETING/TABLENAME\" or \"[SCHEMA]::database.[TABLENAME]\"
eg. WHERE DDLANGUAGE='E'
WHERE DDLANGUAGE<>''
The result should look something like this:
sqoop import --connect "jdbc:sap://[SERVER]:30015/?currentschema=[SCHEMA]" \
--username [USERNAME] \
--password-file file:///[PATH]/.pwd_file \
--driver com.sap.db.jdbc.Driver \
--query "select * from \"[/TABLENAME/WITH/FORWARDSLASHES]\" WHERE DDLANGUAGE='E' and [COLUMNNAME]<>'' and \$CONDITIONS" --hive-import \
--hive-database [HIVEDATABASE] \
--hive-table [TABLENAME] \
--hive-delims-replacement ' ' \
--fields-terminated-by '|' \
--lines-terminated-by '\n' \
--hive-overwrite --num-mappers 1