<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Reader Account on Marmanold.com</title><link>https://marmanold.com/tags/reader-account/</link><description>Recent content in Reader Account on Marmanold.com</description><generator>Hugo</generator><language>en-US</language><image><url>https://marmanold.com/favicon/favicon-32x32.png</url><title>Marmanold.com</title><link>https://marmanold.com/</link></image><managingEditor>michael@rnold.info (Michael W. Arnold)</managingEditor><lastBuildDate>Fri, 28 Feb 2025 15:40:44 -0600</lastBuildDate><atom:link href="https://marmanold.com/tags/reader-account/index.xml" rel="self" type="application/rss+xml"/><item><title>Error in Secure Object</title><link>https://marmanold.com/tech/error-in-secure-object/</link><pubDate>Mon, 03 Mar 2025 16:15:05 -0600</pubDate><guid>https://marmanold.com/tech/error-in-secure-object/</guid><dc:creator>Michael W. Arnold</dc:creator><category>snowflake</category><category>secure view</category><category>secure share</category><category>reader account</category><category>error</category><category>secure object</category><media:thumbnail url="https://marmanold.com/img/site_images/_etc/error_in_secure_object.png"/><description>&lt;p&gt;Recently I&amp;rsquo;ve been working with &lt;a href="https://docs.snowflake.com/en/user-guide/data-sharing-intro"&gt;secure data sharing&lt;/a&gt; in &lt;a href="https://www.snowflake.com"&gt;Snowflake&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve not yet shared our data using a normal private share to another Snowflake account, but I&amp;rsquo;ve tested everything. Using &lt;code&gt;SIMULATED_DATA_SHARING_CONSUMER&lt;/code&gt; and setting the consumer id to my expected account, I was getting data back from the share and everything was working fine.&lt;/p&gt;
&lt;p&gt;Today, however, we got a request to share our data to a &lt;a href="https://docs.snowflake.com/en/user-guide/data-sharing-reader-create"&gt;managed reader account&lt;/a&gt;. I created the account, logged in, copied the share into a database, and could see all of my secure views. But, when I went to query the view, some of the views that were previously working, suddenly were not. All I got back was an ominous &amp;ldquo;Error in secure object.&amp;rdquo;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Recently I&amp;rsquo;ve been working with &lt;a href="https://docs.snowflake.com/en/user-guide/data-sharing-intro"&gt;secure data sharing&lt;/a&gt; in &lt;a href="https://www.snowflake.com"&gt;Snowflake&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve not yet shared our data using a normal private share to another Snowflake account, but I&amp;rsquo;ve tested everything. Using &lt;code&gt;SIMULATED_DATA_SHARING_CONSUMER&lt;/code&gt; and setting the consumer id to my expected account, I was getting data back from the share and everything was working fine.&lt;/p&gt;
&lt;p&gt;Today, however, we got a request to share our data to a &lt;a href="https://docs.snowflake.com/en/user-guide/data-sharing-reader-create"&gt;managed reader account&lt;/a&gt;. I created the account, logged in, copied the share into a database, and could see all of my secure views. But, when I went to query the view, some of the views that were previously working, suddenly were not. All I got back was an ominous &amp;ldquo;Error in secure object.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;My view looked something like the below. It was a simple view, no private functions, and nothing fancy.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-sql" data-lang="sql"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;CREATE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;OR&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;REPLACE&lt;/span&gt; SECURE &lt;span style="color:#66d9ef"&gt;VIEW&lt;/span&gt; secure.student &lt;span style="color:#66d9ef"&gt;AS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;SELECT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ss.id &lt;span style="color:#66d9ef"&gt;AS&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;student_id&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ss.&lt;span style="color:#e6db74"&gt;&amp;#34;name&amp;#34;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;AS&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;student_name&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sv.groups &lt;span style="color:#66d9ef"&gt;As&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;group&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; private.students &lt;span style="color:#66d9ef"&gt;AS&lt;/span&gt; ss
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;INNER&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;JOIN&lt;/span&gt; private.v_student_groups &lt;span style="color:#66d9ef"&gt;AS&lt;/span&gt; sv &lt;span style="color:#66d9ef"&gt;ON&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sv.student_id &lt;span style="color:#f92672"&gt;=&lt;/span&gt; ss.id
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;INNER&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;JOIN&lt;/span&gt; private.sharing_access &lt;span style="color:#66d9ef"&gt;AS&lt;/span&gt; sa &lt;span style="color:#66d9ef"&gt;ON&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sa.school_id &lt;span style="color:#f92672"&gt;=&lt;/span&gt; ss.school_id
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;AND&lt;/span&gt; sa.snowflake_account &lt;span style="color:#f92672"&gt;=&lt;/span&gt; current_account();
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After much trial and error, I finally figured out what the issue was. I&amp;rsquo;m not sure if this applies only to managed reader accounts or all shares, but at least in my case there are a few things that just &lt;em&gt;aren&amp;rsquo;t&lt;/em&gt; allowed in a Snowflake secure view.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ss.&amp;quot;name&amp;quot;&lt;/code&gt; had to be changed to &lt;code&gt;ss.name&lt;/code&gt;; I.e no quoted column references&lt;/li&gt;
&lt;li&gt;My join to &lt;code&gt;v_student_groups&lt;/code&gt; (a view) had to go.; You can join to tables, but views are out of the question, it would seem.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I didn&amp;rsquo;t see any of this documented anywhere, so I hope this gets indexed and helps the next guy banging his head against this issue.&lt;/p&gt;
&lt;p&gt;tldr; If you&amp;rsquo;re getting an &lt;code&gt;Error in secure object&lt;/code&gt; response when querying a secure view in a Snowflake managed reader account, you need to make some minor changes to the SQL in your views before it&amp;rsquo;ll run.&lt;/p&gt;</content:encoded></item></channel></rss>