2

作为 Snowflake WebUI Essentials 课程的一部分,我正在尝试将 AWS S3 存储桶上的“WEIGHT.TXT”中的数据加载到 Snowflake DB 表中。

select * from weight_ingest

> Result: 0 rows
list @S3TESTBKT/W

> Result:1 
> s3://my-s3-tstbkt/WEIGHT.txt  509814  6e66e0c954a0dfe2c5d9638004a98912 Tue, 17 Dec 2019 14:52:52 GMT
COPY INTO WEIGHT_INGEST
FROM @S3TESTBKT/W
FILES = 'WEIGHT.TXT'
FILE_FORMAT = (FORMAT_NAME=USDA_FILE_FORMAT)

> Result: Copy executed with 0 files processed.

有人可以帮我解决这个问题吗?提前致谢。

更多信息:

S3 对象 URL:(https://my-s3-tstbkt.s3.amazonaws.com/WEIGHT.txt我可以在浏览器中打开文件内容)

文件路径:s3://my-s3-tstbkt/WEIGHT.txt

文件格式定义:

ALTER FILE FORMAT "USDA_NUTRIENT_STDREF"."PUBLIC".USDA_FILE_FORMAT 
SET COMPRESSION = 'AUTO' 
FIELD_DELIMITER = '^' 
RECORD_DELIMITER = '\n' 
SKIP_HEADER = 0 
FIELD_OPTIONALLY_ENCLOSED_BY = 'NONE' 
TRIM_SPACE = FALSE 
ERROR_ON_COLUMN_COUNT_MISMATCH = TRUE 
ESCAPE = 'NONE' 
ESCAPE_UNENCLOSED_FIELD = '\134' 
DATE_FORMAT = 'AUTO' 
TIMESTAMP_FORMAT = 'AUTO' 
NULL_IF = ('\\N');

阶段定义:

ALTER STAGE "USDA_NUTRIENT_STDREF"."PUBLIC"."S3TESTBKT" 
SET URL = 's3://my-s3-tstbkt';
```
4

1 回答 1

1

我相信问题出在您的复制命令上。尝试以下步骤:

执行 list 命令获取文件列表:

List @S3TESTBKT

如果您的源文件出现在这里,请确保您的复制命令中的文件夹名称。

COPY INTO WEIGHT_INGEST
FROM @S3TESTBKT/
FILES = ('WEIGHT.txt')
FILE_FORMAT = (FORMAT_NAME = USDA_FILE_FORMAT);
于 2019-12-18T04:39:59.863 回答