<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SAS/ACCESS to Interface To Snowflake Issues with ROLE and WAREHOUSE libname options in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977093#M378425</link>
    <description>&lt;P&gt;We are extending an existing process to access a new Snowflake database. Thus is Release 9.04.01M7P080520&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the existing processes that all work for over a year now, the WAREHOUSE does not need to be defined in the libname -- there is a default warehouse associated with the role.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the new database there is no default WAREHOUSE, and there is a new ROLE. The signon is the same Snowflake account that we have used all the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So to start with we issue this libname:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname FCH_data SNOW &lt;BR /&gt;server ="bnz_dap_prod_aws.ap-southeast-2.privatelink.snowflakecomputing.com" &lt;BR /&gt;user =SRV_FCH_SAS_UAT02_SASCONNECT &lt;BR /&gt;pw ='XXXXXXXXXXXXXXXXX' &lt;BR /&gt;database =DB_LENDING_UAT02&lt;BR /&gt;role =RL_SF_DP_MDS_CONSUMER_UAT02&lt;BR /&gt;&amp;nbsp;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This results in&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;60 create table mytable as&lt;BR /&gt;61 (select * from connection to fch_data&lt;BR /&gt;62 (&lt;BR /&gt;63 select * from DB_LENDING_UAT02.MDS_CCD.ccd_accounts_sas&lt;BR /&gt;64 limit 10&lt;BR /&gt;65 &lt;BR /&gt;66 )&lt;BR /&gt;67 )&lt;BR /&gt;68 ;&lt;BR /&gt;&lt;STRONG&gt;ERROR: CLI open cursor error: No active warehouse selected in the current session. Select an active warehouse with the 'use &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;warehouse' command.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So thats fairly simple, I need to define a warehouse. So I got the warehouse from the Snowflake team and submitted this libname (the Snowflake admin confirmed that all necessary grants are in place and I sent them the grant stream from the original database to mimic)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname FCH_data SNOW &lt;BR /&gt;server ="bnz_dap_prod_aws.ap-southeast-2.privatelink.snowflakecomputing.com" &lt;BR /&gt;user =SRV_FCH_SAS_UAT02_SASCONNECT&lt;BR /&gt;database =DB_LENDING_UAT02&lt;BR /&gt;role =RL_SF_DP_MDS_CONSUMER_UAT02&amp;nbsp;&lt;BR /&gt;warehouse =wh_lending_m&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is clear though that this did not set&amp;nbsp; the warehouse. We got the same No ACTIVE WAREHOUSE message. So I added a simple check of running an SQL to query the warehouse and sure enough there is no warehouse defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;create table mytable as&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; (select * from connection to fch_data&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp;SELECT CURRENT_WAREHOUSE();&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; )&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I commented out the ROLE in the libname and tried again, but the warehouse doesnt get set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After reading up a bit on Snowflake I realised the libname isnt the only way to set the WAREHOUSE. I can just execute the USE WAREHOUSE XXXXX command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I did this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql ;&lt;/P&gt;
&lt;P&gt;connect using fch_data ;&lt;/P&gt;
&lt;P&gt;execute (use warehouse wh_lending_m) by fch_data ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That also fails, with this Snowflake message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ERROR: CLI execute error: SQL compilation error: Object does not exist, or operation cannot be performed.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point one of my teammates started to experiment and removed the ROLE from the libname. That failed, but then he changed the WAREHOUSE to the original one (which we dont want to use as the COMPUTE cost shouldnt be against that database). That worked and set the WAREHOUSE. The query didnt work as there is no ROLE.&lt;BR /&gt;&lt;BR /&gt;So I placed the ROLE in an EXECUTE instead of the libname&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;execute (use role RL_SF_DP_MDS_CONSUMER_UAT02;) by fch_data ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select current_role() shows that worked fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I then added the WAREHOUSE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;execute (use role RL_SF_DP_MDS_CONSUMER_UAT02;) by fch_data ; &lt;BR /&gt;execute (use warehouse wh_lending_m;) by fch_data ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The role was set, the WAREHOUSE is not ACTIVE. So that tends to verify that the problem is unrelated to the libname.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried flipping the WAREHOUSE to run before the USE ROLE but no WAREHOUSE is defined&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So we have this situation, whether its libname or EXECUTE&lt;BR /&gt;&lt;BR /&gt;*&amp;nbsp; if the warehouse is defined as the new warehouse in the new database, it does not get set whether from the libname or execute. No query runs as there is no warehouse. select current_warehouse() verifies no warehouse exists&lt;/P&gt;
&lt;P&gt;*&amp;nbsp; if the warehouse is the old warehouse which we have a directive to not use, then it is set provided the ROLE is not set in libname or EXECUTE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*&amp;nbsp; The old role cant run queries in the new database (thats intentional there is no grant for that role, and if it could the COMPUTE costs would be against wrong database) . We will get that grant done to see if it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But -- has anyone struck this issue of WAREHOUSE and ROLE being in conflict from SAS??? OI did think maybe the Snowflake grants are not right, but Snowflake admin is sure they are ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Oct 2025 21:09:42 GMT</pubDate>
    <dc:creator>bitcruncher</dc:creator>
    <dc:date>2025-10-15T21:09:42Z</dc:date>
    <item>
      <title>SAS/ACCESS to Interface To Snowflake Issues with ROLE and WAREHOUSE libname options</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977093#M378425</link>
      <description>&lt;P&gt;We are extending an existing process to access a new Snowflake database. Thus is Release 9.04.01M7P080520&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the existing processes that all work for over a year now, the WAREHOUSE does not need to be defined in the libname -- there is a default warehouse associated with the role.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the new database there is no default WAREHOUSE, and there is a new ROLE. The signon is the same Snowflake account that we have used all the time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So to start with we issue this libname:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname FCH_data SNOW &lt;BR /&gt;server ="bnz_dap_prod_aws.ap-southeast-2.privatelink.snowflakecomputing.com" &lt;BR /&gt;user =SRV_FCH_SAS_UAT02_SASCONNECT &lt;BR /&gt;pw ='XXXXXXXXXXXXXXXXX' &lt;BR /&gt;database =DB_LENDING_UAT02&lt;BR /&gt;role =RL_SF_DP_MDS_CONSUMER_UAT02&lt;BR /&gt;&amp;nbsp;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This results in&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;60 create table mytable as&lt;BR /&gt;61 (select * from connection to fch_data&lt;BR /&gt;62 (&lt;BR /&gt;63 select * from DB_LENDING_UAT02.MDS_CCD.ccd_accounts_sas&lt;BR /&gt;64 limit 10&lt;BR /&gt;65 &lt;BR /&gt;66 )&lt;BR /&gt;67 )&lt;BR /&gt;68 ;&lt;BR /&gt;&lt;STRONG&gt;ERROR: CLI open cursor error: No active warehouse selected in the current session. Select an active warehouse with the 'use &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;warehouse' command.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So thats fairly simple, I need to define a warehouse. So I got the warehouse from the Snowflake team and submitted this libname (the Snowflake admin confirmed that all necessary grants are in place and I sent them the grant stream from the original database to mimic)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname FCH_data SNOW &lt;BR /&gt;server ="bnz_dap_prod_aws.ap-southeast-2.privatelink.snowflakecomputing.com" &lt;BR /&gt;user =SRV_FCH_SAS_UAT02_SASCONNECT&lt;BR /&gt;database =DB_LENDING_UAT02&lt;BR /&gt;role =RL_SF_DP_MDS_CONSUMER_UAT02&amp;nbsp;&lt;BR /&gt;warehouse =wh_lending_m&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is clear though that this did not set&amp;nbsp; the warehouse. We got the same No ACTIVE WAREHOUSE message. So I added a simple check of running an SQL to query the warehouse and sure enough there is no warehouse defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;create table mytable as&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; (select * from connection to fch_data&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp;SELECT CURRENT_WAREHOUSE();&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; )&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I commented out the ROLE in the libname and tried again, but the warehouse doesnt get set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After reading up a bit on Snowflake I realised the libname isnt the only way to set the WAREHOUSE. I can just execute the USE WAREHOUSE XXXXX command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I did this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql ;&lt;/P&gt;
&lt;P&gt;connect using fch_data ;&lt;/P&gt;
&lt;P&gt;execute (use warehouse wh_lending_m) by fch_data ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That also fails, with this Snowflake message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ERROR: CLI execute error: SQL compilation error: Object does not exist, or operation cannot be performed.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point one of my teammates started to experiment and removed the ROLE from the libname. That failed, but then he changed the WAREHOUSE to the original one (which we dont want to use as the COMPUTE cost shouldnt be against that database). That worked and set the WAREHOUSE. The query didnt work as there is no ROLE.&lt;BR /&gt;&lt;BR /&gt;So I placed the ROLE in an EXECUTE instead of the libname&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;execute (use role RL_SF_DP_MDS_CONSUMER_UAT02;) by fch_data ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;select current_role() shows that worked fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I then added the WAREHOUSE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;execute (use role RL_SF_DP_MDS_CONSUMER_UAT02;) by fch_data ; &lt;BR /&gt;execute (use warehouse wh_lending_m;) by fch_data ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The role was set, the WAREHOUSE is not ACTIVE. So that tends to verify that the problem is unrelated to the libname.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried flipping the WAREHOUSE to run before the USE ROLE but no WAREHOUSE is defined&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So we have this situation, whether its libname or EXECUTE&lt;BR /&gt;&lt;BR /&gt;*&amp;nbsp; if the warehouse is defined as the new warehouse in the new database, it does not get set whether from the libname or execute. No query runs as there is no warehouse. select current_warehouse() verifies no warehouse exists&lt;/P&gt;
&lt;P&gt;*&amp;nbsp; if the warehouse is the old warehouse which we have a directive to not use, then it is set provided the ROLE is not set in libname or EXECUTE.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*&amp;nbsp; The old role cant run queries in the new database (thats intentional there is no grant for that role, and if it could the COMPUTE costs would be against wrong database) . We will get that grant done to see if it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But -- has anyone struck this issue of WAREHOUSE and ROLE being in conflict from SAS??? OI did think maybe the Snowflake grants are not right, but Snowflake admin is sure they are ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Oct 2025 21:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977093#M378425</guid>
      <dc:creator>bitcruncher</dc:creator>
      <dc:date>2025-10-15T21:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/ACCESS to Interface To Snowflake Issues with ROLE and WAREHOUSE libname options</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977145#M378431</link>
      <description>Assumed you have tested&lt;BR /&gt;use role RL_SF_DP_MDS_CONSUMER_UAT02;&lt;BR /&gt;use warehouse wh_lending_m;&lt;BR /&gt;in Snowsight, using the SRV_FCH_SAS_UAT02_SASCONNECT login?</description>
      <pubDate>Thu, 16 Oct 2025 12:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977145#M378431</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-10-16T12:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS/ACCESS to Interface To Snowflake Issues with ROLE and WAREHOUSE libname options</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977212#M378450</link>
      <description>&lt;P&gt;What does your SAS log report when you assign the SNOW LIBNAME? Do you get something like this?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASKiwi_0-1760650584152.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/110698i2EA52D7D6D167770/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASKiwi_0-1760650584152.png" alt="SASKiwi_0-1760650584152.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I've never had any problems with Snowflake not recognising the WAREHOUSE option. Maybe try adding SCHEMA = PUBLIC as well to see if that helps.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2025 21:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-ACCESS-to-Interface-To-Snowflake-Issues-with-ROLE-and/m-p/977212#M378450</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-10-16T21:36:49Z</dc:date>
    </item>
  </channel>
</rss>

