<?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: Is there anyway to execute grant and revoke statements to a user for an object based on a condition? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/is-there-anyway-to-execute-grant-and-revoke-statements-to-a-user/m-p/10451#M5626</link>
    <description>&lt;P&gt;Hi, GRANT and REVOKE are &lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html?&amp;amp;_ga=2.193434603.799059143.1675584833-925182843.1674505910#privilege-types" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html?&amp;amp;_ga=2.193434603.799059143.1675584833-925182843.1674505910#privilege-types" target="_blank"&gt;privilege&lt;/A&gt;s&amp;nbsp;on an&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" target="_blank"&gt;securable object&lt;/A&gt;&amp;nbsp;to a&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-principal.html" alt="https://docs.databricks.com/sql/language-manual/sql-ref-principal.html" target="_blank"&gt;principal&lt;/A&gt;. And a principal is a user, service principal, or group known to the metastore. Principals can be granted&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#privilege-types" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#privilege-types" target="_blank"&gt;privileges&lt;/A&gt;&amp;nbsp;and may own&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" target="_blank"&gt;securable objects&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Also, you can use&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/security-revoke-share.html" alt="https://docs.databricks.com/sql/language-manual/security-revoke-share.html" target="_blank"&gt;REVOKE ON SHARE&lt;/A&gt;&amp;nbsp;to revoke access on&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" target="_blank"&gt;shares&lt;/A&gt;&amp;nbsp;from&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" target="_blank"&gt;recipients&lt;/A&gt; and you can use&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/security-grant-share.html" alt="https://docs.databricks.com/sql/language-manual/security-grant-share.html" target="_blank"&gt;GRANT ON SHARE&lt;/A&gt;&amp;nbsp;to grant&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" target="_blank"&gt;recipients&lt;/A&gt;&amp;nbsp;access to&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" target="_blank"&gt;shares&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Please refer: &lt;A href="https://docs.databricks.com/sql/language-manual/security-grant.html" alt="https://docs.databricks.com/sql/language-manual/security-grant.html" target="_blank"&gt;https://docs.databricks.com/sql/language-manual/security-grant.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/sql/language-manual/security-revoke.html" alt="https://docs.databricks.com/sql/language-manual/security-revoke.html" target="_blank"&gt;https://docs.databricks.com/sql/language-manual/security-revoke.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 05 Feb 2023 13:12:53 GMT</pubDate>
    <dc:creator>Debayan</dc:creator>
    <dc:date>2023-02-05T13:12:53Z</dc:date>
    <item>
      <title>Is there anyway to execute grant and revoke statements to a user for an object based on a condition?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-there-anyway-to-execute-grant-and-revoke-statements-to-a-user/m-p/10450#M5625</link>
      <description>&lt;P&gt;SELECT if((select count(*) from information_schema.table_privileges where grantee = 'samo@test.com' and table_schema='demo_schema' and table_catalog='demo_catalog')==1, (select count(*) from demo_catalog.demo_schema.demo_table), (select count(*) from demo_catalog.demo_schema.demo_table2));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above query is working and I'm getting the result. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what I'm trying to achieve is that,&lt;/P&gt;&lt;P&gt; if &lt;/P&gt;&lt;P&gt;select count(*) from information_schema.table_privileges where grantee = 'samo@test.com' and table_schema='demo_schema' and table_catalog='demo_catalog')==1&lt;/P&gt;&lt;P&gt;If the above condition is true , then I want to run the below subqueries altogether:&lt;/P&gt;&lt;P&gt;revoke select on table demo_catalog.demo_schema.demo_table from `samo@test.com`;revoke usage on catalog demo_catalog from `samo@test.com`;revoke usage on schema demo_catalog.demo_schema from `samo@test.com`;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, for a user,  if there is access to only one table, then I want to revoke the access from table, schema and catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to achieve this, if yes, How to achieve it?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 09:48:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-there-anyway-to-execute-grant-and-revoke-statements-to-a-user/m-p/10450#M5625</guid>
      <dc:creator>data_explorer</dc:creator>
      <dc:date>2023-01-31T09:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is there anyway to execute grant and revoke statements to a user for an object based on a condition?</title>
      <link>https://community.databricks.com/t5/data-engineering/is-there-anyway-to-execute-grant-and-revoke-statements-to-a-user/m-p/10451#M5626</link>
      <description>&lt;P&gt;Hi, GRANT and REVOKE are &lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html?&amp;amp;_ga=2.193434603.799059143.1675584833-925182843.1674505910#privilege-types" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html?&amp;amp;_ga=2.193434603.799059143.1675584833-925182843.1674505910#privilege-types" target="_blank"&gt;privilege&lt;/A&gt;s&amp;nbsp;on an&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" target="_blank"&gt;securable object&lt;/A&gt;&amp;nbsp;to a&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-principal.html" alt="https://docs.databricks.com/sql/language-manual/sql-ref-principal.html" target="_blank"&gt;principal&lt;/A&gt;. And a principal is a user, service principal, or group known to the metastore. Principals can be granted&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#privilege-types" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#privilege-types" target="_blank"&gt;privileges&lt;/A&gt;&amp;nbsp;and may own&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" alt="https://docs.databricks.com/sql/language-manual/sql-ref-privileges.html#securable-objects" target="_blank"&gt;securable objects&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Also, you can use&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/security-revoke-share.html" alt="https://docs.databricks.com/sql/language-manual/security-revoke-share.html" target="_blank"&gt;REVOKE ON SHARE&lt;/A&gt;&amp;nbsp;to revoke access on&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" target="_blank"&gt;shares&lt;/A&gt;&amp;nbsp;from&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" target="_blank"&gt;recipients&lt;/A&gt; and you can use&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/security-grant-share.html" alt="https://docs.databricks.com/sql/language-manual/security-grant-share.html" target="_blank"&gt;GRANT ON SHARE&lt;/A&gt;&amp;nbsp;to grant&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#recipients" target="_blank"&gt;recipients&lt;/A&gt;&amp;nbsp;access to&amp;nbsp;&lt;A href="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" alt="https://docs.databricks.com/sql/language-manual/sql-ref-sharing.html#shares" target="_blank"&gt;shares&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Please refer: &lt;A href="https://docs.databricks.com/sql/language-manual/security-grant.html" alt="https://docs.databricks.com/sql/language-manual/security-grant.html" target="_blank"&gt;https://docs.databricks.com/sql/language-manual/security-grant.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/sql/language-manual/security-revoke.html" alt="https://docs.databricks.com/sql/language-manual/security-revoke.html" target="_blank"&gt;https://docs.databricks.com/sql/language-manual/security-revoke.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 13:12:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/is-there-anyway-to-execute-grant-and-revoke-statements-to-a-user/m-p/10451#M5626</guid>
      <dc:creator>Debayan</dc:creator>
      <dc:date>2023-02-05T13:12:53Z</dc:date>
    </item>
  </channel>
</rss>

