sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Babu, Prashanth" <Prashanth.B...@nttdata.com>
Subject Issue with Sqoop column aliases
Date Fri, 13 Sep 2013 02:56:22 GMT
Hi,



I came across an issue in Sqoop v1.4.4 import for column aliases. I remember it was present
even in earlier versions [I first saw this issue in v1.2.0 dating back to mid-2011].



Consider a Sqoop eval:

sqoop eval --connect jdbc:mysql://my_ip/my_db --username root --password **** --query "SELECT
c.id AS cid, concat(c.firstname, c.lastname) AS name FROM customer c LIMIT 10"



The above query gets me the data as required and but one of the column aliases is incorrect
[instead of cid, it shows the column alias as id].

id            name



I have found a workaround [though it is not elegant per-se]

sqoop eval --connect jdbc:mysql://my_ip/my_db --username root --password **** --query "SELECT
concat(c.id, '') AS cid, concat(c.firstname, c.lastname) AS name FROM customer c LIMIT 10"



The above query gets me the data as required and with the exact column aliases I have mentioned.

cid          name



I am not sure if I am missing something here.

Is it like if I am getting just the column, Sqoop does not consider the column alias. And
if I give a function like concat as above, it considers the column alias as well?



Thanks.



Regards,

Prashanth.

______________________________________________________________________
Disclaimer:This email and any attachments are sent in strictest confidence for the sole use
of the addressee and may contain legally privileged, confidential, and proprietary data. 
If you are not the intended recipient, please advise the sender by replying promptly to this
email and then delete and destroy this email and any attachments without any further use,
copying or forwarding
Mime
View raw message