0

I'm trying to use the "test" folder name as dynamic folder path for Snowflake stage creation, which comes after the s3 url.

Copy command runs but returns zero records.

  create or replace stage MYSQL_S3 url='s3://myproject/product/BackEnd/'
  credentials=(aws_key_id='x' aws_secret_key='s' AWS_TOKEN='s')
  file_format = myformat.format_csv;


 copy into test from @MYSQL_S3 pattern = 'test/'

Anything is missing?

Sundar
  • 95
  • 1
  • 13

1 Answers1

0

Try pattern='.*test/.*'. Pattern is a regex and has to match the path (S3 key) and the filename. You can use LIST to see what the pattern is matching.

Or to append test/ to the stage url, try copy into test from @MYSQL_S3/test/;

waldente
  • 1,324
  • 9
  • 12
  • any work around for this type 'copy into test from @MYSQL_S3/test/;' ? – Sundar Feb 25 '20 at 10:11
  • Glad the regex is working. Are you trying to to get `@MYSQL_S3/test/` to resolve to `s3://myproject/product/BackEnd/test/`? If so, please try removing the trailing slash in your url when you create the stage. That may be resulting in two slashes in the path. – waldente Feb 25 '20 at 14:15