Search code examples
azureurlsnowflake-cloud-data-platformstage

Snowflake - CREATE STAGE - Pattern for dynamic url with Azure


I would like to specify a dynamic url for a stage but * doesn't work. Is there some way to do it ?

I would like to do something like this:

CREATE OR REPLACE STAGE MY_STAGE
  url                   = 'azure://mystorage.blob.core.windows.net/mycontainer/myfolder/*/myparquet'  
  credentials           = ...
  file_format           = (type = 'parquet')
;

Solution

  • I'm not sure if there's a way to do this in a stage, but you can do it in your copy statements.

    so you can set up your stage like this:

    CREATE OR REPLACE STAGE MY_STAGE
      url                   = 'azure://mystorage.blob.core.windows.net/mycontainer/myfolder/'  
      credentials           = ...
      file_format           = (type = 'parquet')
    ;
    

    and then use a copy into statement that looks something like this:

    copy into mytable
    from @MY_STAGE
      pattern='.*/myparquet';
    

    See Copy into documentation.