1

below copy command is not working , please correct me if something wrong.

copy into mytable
from  @mystage
pattern='20.*csv.gz'

here i am trying to load the files which are starts with 20, there are mix of files which are having the name as 2021myfile.csv.gz, myfile202109.csv.gz, above command is not loading any files though there are files which starts with 20. if i use pattern as pattern='.*20.*csv.gz' it is taking all the files which is wrong, i need to load only the files that are starts with 20.

2 Answers 2

1

This is because the pattern clause is a Regex expression. Try this:

copy into mytable from @mystage pattern = '[20]*.*csv.gz'

Reference: Loading Using Pattern Matching

Sign up to request clarification or add additional context in comments.

1 Comment

I'm having a similar problem, cannot match upper cases, do you have a solution for that?
0

2021myfile.csv.gz, myfile202109.csv.gz both has .20 means anything could be before 20 or not so it will load both the files. if it is inside a folder than . is necessary try something like .*/20.*csv.gz.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.