我正在尝试使用Sqoop将数据从数据湖导出到我在Azure SQL Server中设置的表中。这一切都在Azure数据工厂中。该表的模式与文件名的模式匹配,但有一个例外...我在表中有一个名为“ file_name”的列,我想从文件本身填充该字段(此字段不在原始数据中) 。这是我尝试过的代码。
sqoop-export
--connect "jdbc:sqlserver://server_name.database.windows.net:1433;username=user_name;password='pass word';database=db_name"
--table REUTERS_CW
--export-dir adl://rawdata/corp/file_name.gz
--input-fields-terminated-by "|"
当我运行它时,出现此错误:
<console>:10: error: identifier expected but string literal found.
--input-fields-terminated-by "|"
我不确定三件事。
#1) My password actually has spaces in it; I think wrapping that in quotes will fix it.
#2) I'm running this in Scala in Azure Databricks; I'm guessing that's oen way to do it, but I don't know for sure.
#3) I'm not certain about how to copy the data from the file and simultaneously append the file name relative to the data that's supposed to be copied over.
我正在下面的链接中查看示例。
https://docs.microsoft.com/en-us/azure/data-lake-store/data-lake-store-data-transfer-sql-sqoop
sqoop-export:
--export-dir
参数和--table
或--call
之一是必需的。它们指定要在数据库(或要调用的存储过程)中填充的表,以及HDFS中包含源数据的目录。
sqoop-import
:希望这会有所帮助。