<?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: Create Scalar Function in Redshift Using Pass-Through in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726010#M225586</link>
    <description>&lt;P&gt;What is the $$ syntax in the Redshift code?&amp;nbsp; Is it possible that Redshift is treating end of line characters as having meaning in parsing the syntax of your function definition? It doubt that SAS will preserve and end of line characters in strings it passes to the remote database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I am not sure there is much loss in functionality to not be able to create functions from SAS.&amp;nbsp; In general you will probably just be wanting to just query the data from SAS so you can analyze it.&amp;nbsp; Most of the database I query don't allow me to create objects in them anyway.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Mar 2021 23:03:39 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-03-12T23:03:39Z</dc:date>
    <item>
      <title>Create Scalar Function in Redshift Using Pass-Through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/725843#M225531</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!&amp;nbsp; I am trying to create the function below as a UDF in Redshift using SAS Pass-Through.&amp;nbsp; This is the same setup I have used in the past to create other functions as well as pass-through some SQL queries.&amp;nbsp; I believe SAS is not liking the whitespace that is required for the Python function.&amp;nbsp; My log with the error is below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 %studio_hide_wrapper;&lt;BR /&gt;82 %studio_show_wrapper;&lt;BR /&gt;84 %studio_restore_wrapper;&lt;BR /&gt;85&lt;BR /&gt;86 proc sql;&lt;BR /&gt;87 connect using schema1 as dbcon;&lt;BR /&gt;88&lt;BR /&gt;89 EXECUTE(&lt;BR /&gt;90 create or replace function schema1.f_py_greater (a float, b float)&lt;BR /&gt;91&amp;nbsp; &amp;nbsp; &amp;nbsp;returns float&lt;BR /&gt;92 stable&lt;BR /&gt;93 as $$&lt;BR /&gt;94&amp;nbsp; &amp;nbsp; &amp;nbsp;if a &amp;gt; b:&lt;BR /&gt;95&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return a&lt;BR /&gt;96&amp;nbsp; &amp;nbsp; &amp;nbsp;return b&lt;BR /&gt;97 $$ language plpythonu) by dbcon;&lt;BR /&gt;ERROR: CLI execute error: [SAS][ODBC Redshift Wire Protocol driver][Redshift]ERROR: Failed to compile udf(Detail&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------------&lt;BR /&gt;error: Failed to compile udf&lt;BR /&gt;code: 10000&lt;BR /&gt;context: File&lt;BR /&gt;"/rds/bin/padb.1.0.00000/data/udf/45/7410258963/fb9915f88af178c5b64300a52e5010c3d26bb3b1/0.py", line 2&lt;BR /&gt;if a &amp;gt; b: return&lt;BR /&gt;a return b&lt;BR /&gt;^&lt;BR /&gt;SyntaxError: invalid syntax&lt;BR /&gt;query: 0&lt;BR /&gt;location: cg_addins.cpp:257&lt;BR /&gt;&lt;BR /&gt;process: padbmaster [pid=78392]&lt;BR /&gt;------------------------&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;98&lt;BR /&gt;99 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 0.10 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 17:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/725843#M225531</guid>
      <dc:creator>tonyballard72</dc:creator>
      <dc:date>2021-03-12T17:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create Scalar Function in Redshift Using Pass-Through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/725998#M225578</link>
      <description>&lt;P&gt;Do you have access to a genuine Redshift SQL client to test this in? In my experience if it works OK in a genuine SQL-specific client it will work in SAS passthru. This holds true with Oracle and SQL Server databases I've used recently.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 22:06:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/725998#M225578</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-12T22:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create Scalar Function in Redshift Using Pass-Through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726007#M225585</link>
      <description>&lt;P&gt;Yes, I do.&amp;nbsp; If I create the function in SQL client we have, using the same language within my EXECUTE() statement, it creates just fine.&amp;nbsp; I am just confused as to why the code fails when I am using pass-through in SAS.&amp;nbsp; Ideally, I would prefer not to have to use multiple clients in the future just to create some functions in Redshift.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 22:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726007#M225585</guid>
      <dc:creator>tonyballard72</dc:creator>
      <dc:date>2021-03-12T22:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create Scalar Function in Redshift Using Pass-Through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726010#M225586</link>
      <description>&lt;P&gt;What is the $$ syntax in the Redshift code?&amp;nbsp; Is it possible that Redshift is treating end of line characters as having meaning in parsing the syntax of your function definition? It doubt that SAS will preserve and end of line characters in strings it passes to the remote database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I am not sure there is much loss in functionality to not be able to create functions from SAS.&amp;nbsp; In general you will probably just be wanting to just query the data from SAS so you can analyze it.&amp;nbsp; Most of the database I query don't allow me to create objects in them anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 23:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726010#M225586</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-12T23:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Create Scalar Function in Redshift Using Pass-Through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726067#M225602</link>
      <description>&lt;P&gt;I'm guessing that the setup for the Redshift client is different to the SAS passthru version. Maybe some additional settings are required? Perhaps a Redshift DBA can help? Might be worth opening a track with SAS Tech Support too.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 22:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-Scalar-Function-in-Redshift-Using-Pass-Through/m-p/726067#M225602</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-13T22:59:08Z</dc:date>
    </item>
  </channel>
</rss>

