<?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 Re: Improve code efficiency when retrieving data from Snowflake via SAS in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702779#M19672</link>
    <description>&lt;P&gt;Did you try with changing:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;... AS SELECT * FROM CONNECTION TO SNWFLK(...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;... AS SELECT First_name length 50, Last_name length 50 FROM CONNECTION TO SNWFLK(...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;To tell to SAS what is Your expectation about lengths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 11:22:51 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2020-12-01T11:22:51Z</dc:date>
    <item>
      <title>Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702773#M19670</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We are moving away from Greenplum database to Snowflake. Testing a few data retrieving queries, I noticed the run time is longer compared to what it was in Greenplum. I realized this was because the lengths of a few variables were huge (32767). I used to limit these variables length using VARCHAR or CAST statements for Greenplum but am not sure how to do it for Snowflake. There's a thread within the forum discussing the use of readbuff and other options to improve connectivity for Snowflake and I wanted to how could these be used in SQL Passthrough queries. Appreciate your inputs on this.&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CONNECT TO GREENPLM(DSN = GREENPLM USER = USERID PASSWORD=PASSWORD);&lt;/P&gt;&lt;P&gt;CREATE TABLE CUST_INFO AS SELECT * FROM CONNECTION TO GREENPLM(&lt;/P&gt;&lt;P&gt;SELECT FIRST_NAME :: VARCHAR(50) AS FIRST_NAME,&lt;/P&gt;&lt;P&gt;LAST_NAME :: VARHCAR(50) AS LAST_NAME /* these fields are limited to a length of 50 */&lt;/P&gt;&lt;P&gt;FROM CUST_DATA);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CONNECT TO ODBC AS SNWFLK (DSN =SNOWFLAKE USER=USERID PASSWORD=PASSWORD);&lt;/P&gt;&lt;P&gt;CREATE TABLE CUST_INFO AS SELECT * FROM CONNECTION TO SNWFLK(&lt;/P&gt;&lt;P&gt;SELECT FIRST_NAME, LAST_NAME&amp;nbsp; /* these names come with 32767 lengths */&lt;/P&gt;&lt;P&gt;FROM CUST_DATA);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Data-Management/Slow-performance-of-ODBC-connection-to-SNOWFLAKE/m-p/702618#M19668" target="_blank"&gt;https://communities.sas.com/t5/SAS-Data-Management/Slow-performance-of-ODBC-connection-to-SNOWFLAKE/m-p/702618#M19668&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 10:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702773#M19670</guid>
      <dc:creator>sai212</dc:creator>
      <dc:date>2020-12-01T10:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702779#M19672</link>
      <description>&lt;P&gt;Did you try with changing:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;... AS SELECT * FROM CONNECTION TO SNWFLK(...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;... AS SELECT First_name length 50, Last_name length 50 FROM CONNECTION TO SNWFLK(...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;
&lt;P&gt;To tell to SAS what is Your expectation about lengths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 11:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702779#M19672</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-12-01T11:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702810#M19674</link>
      <description>&lt;P&gt;Thank you! This works. How do I use this piece in case, I want to select every variable from the table and also define the lengths?&lt;/P&gt;&lt;P&gt;I tried&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT *, CUST_FIRST_NAME LENGTH 20, CUST_LAST_NAME LENGTH 20 FROM CONNECTION TO SNWFLK(---&lt;/P&gt;&lt;P&gt;but it didn't change saying those variables already exist in the table. Am I missing something here?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 14:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702810#M19674</guid>
      <dc:creator>sai212</dc:creator>
      <dc:date>2020-12-01T14:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702849#M19677</link>
      <description>&lt;P&gt;Try connecting to SnowFlake with a LIBNAME instead of the SQL CONNECT statement.&amp;nbsp; Then you can try using the DBSASTYPE dataset option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another advantage of using the LIBNAME is that you can run PROC CONTENTS on the SnowFlake table to get the list of variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have the list of variables in a dataset then you can use that to generate the code that lists each variable explicitly and sets the appropriate lengths. Either as an SQL query or using the DBSASTYPE option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 17:46:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702849#M19677</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-01T17:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702871#M19679</link>
      <description>&lt;P&gt;Thank you, Tom! But isn't a SQL Passthrough much more efficient than accessing via a LIBNAME statement?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 18:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702871#M19679</guid>
      <dc:creator>sai212</dc:creator>
      <dc:date>2020-12-01T18:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702922#M19680</link>
      <description>&lt;P&gt;Using LIBNAME statements is not necessarily less efficient than PASSTHRU, particularly if you are just doing simple, single table queries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One option that might help you is DBMAX_TEXT:&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=acreldb&amp;amp;docsetTarget=p14o73fqwbby7xn1iqvjbdiixuyj.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=acreldb&amp;amp;docsetTarget=p14o73fqwbby7xn1iqvjbdiixuyj.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will enable you to enforce a maximum length on all character variables being read.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 23:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/702922#M19680</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-12-01T23:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/703052#M19682</link>
      <description>&lt;P&gt;I agree LIBNAME not being bad in case of a single table. I'll look into the DBMAX_TEXT option. Thanks for your input! Appreciate it.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 10:38:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/703052#M19682</guid>
      <dc:creator>sai212</dc:creator>
      <dc:date>2020-12-02T10:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/723305#M19826</link>
      <description>&lt;P&gt;we are in the similar situation.&lt;/P&gt;&lt;P&gt;DBMAX_TEXT or&amp;nbsp;TEXTSIZE option is not worked for us. I believe it works for BLOB types.&lt;/P&gt;&lt;P&gt;did any of you get it work or any other system options to restrict length of the column?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 22:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/723305#M19826</guid>
      <dc:creator>asadiq</dc:creator>
      <dc:date>2021-03-03T22:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/723344#M19827</link>
      <description>It kind of worked for me using CAST statements..CAST(VARIABLE AS VARCHAR()) AS</description>
      <pubDate>Thu, 04 Mar 2021 02:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/723344#M19827</guid>
      <dc:creator>sai212</dc:creator>
      <dc:date>2021-03-04T02:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Improve code efficiency when retrieving data from Snowflake via SAS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/723494#M19829</link>
      <description>&lt;P&gt;Yes, everyone have to setup the CAST for their query.&lt;/P&gt;&lt;P&gt;But Looking for SAS system options otherwise we may need to setup the views for the users.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 16:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Improve-code-efficiency-when-retrieving-data-from-Snowflake-via/m-p/723494#M19829</guid>
      <dc:creator>asadiq</dc:creator>
      <dc:date>2021-03-04T16:02:23Z</dc:date>
    </item>
  </channel>
</rss>

