<?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 libname postgres set role option in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/595029#M17418</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Does anyone know how to set the role in the libname statement for connecting for postgres?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I am currently in the process of saving some datasets from SAS to postgres. I am unable to set a "Role" to be able to write tables into Postgres. The role assigns multiple users the privilge of being able to read/write data with restricted admin privileges limited to data manipulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried creating these datasets using the following code block results in the datasets saved in Postgres only being viewable to Tom (user=Tom). This works, but no other user other than "Tom" can read/write/Amend the data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname psql postgres server=localhost port=5432 user= Tom password= "mypassword" 
database=test schema= "dbtest"; /*change user*/


data psql.tmp ;
set sashelp.shoes;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In order to bypass this read/write issue, i set the role="AdminUse" as noted in the following approach. This works, but means i need to include this code block at every step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql noerrorstop;
   connect to psql as x1(server=localhost port=5432 
      user=Tom password="mypassword" database=test); /*change username here*/

execute( SET ROLE AdminUse;
         CREATE TABLE psql.tmp
         (no int primary key, state varchar(10));
		 RESET ROLE;
          ) by x1;
disconnect from x1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know how to set the role in the libname statement for connecting for postgres?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2019 12:43:40 GMT</pubDate>
    <dc:creator>sebster24</dc:creator>
    <dc:date>2019-10-09T12:43:40Z</dc:date>
    <item>
      <title>SAS libname postgres set role option</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/595029#M17418</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Does anyone know how to set the role in the libname statement for connecting for postgres?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I am currently in the process of saving some datasets from SAS to postgres. I am unable to set a "Role" to be able to write tables into Postgres. The role assigns multiple users the privilge of being able to read/write data with restricted admin privileges limited to data manipulation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried creating these datasets using the following code block results in the datasets saved in Postgres only being viewable to Tom (user=Tom). This works, but no other user other than "Tom" can read/write/Amend the data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname psql postgres server=localhost port=5432 user= Tom password= "mypassword" 
database=test schema= "dbtest"; /*change user*/


data psql.tmp ;
set sashelp.shoes;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In order to bypass this read/write issue, i set the role="AdminUse" as noted in the following approach. This works, but means i need to include this code block at every step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql noerrorstop;
   connect to psql as x1(server=localhost port=5432 
      user=Tom password="mypassword" database=test); /*change username here*/

execute( SET ROLE AdminUse;
         CREATE TABLE psql.tmp
         (no int primary key, state varchar(10));
		 RESET ROLE;
          ) by x1;
disconnect from x1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know how to set the role in the libname statement for connecting for postgres?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2019 12:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/595029#M17418</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2019-10-09T12:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS libname postgres set role option</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/596143#M17435</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3849"&gt;@sebster24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use the option 'conopts' to specify few of these options in a libname statement. You can find example for this in the&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=p1qu1edv1jhk1vn1dumx9uorn6l2.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;documentation&lt;/A&gt;&amp;nbsp;link.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Example:	This example specifies an SSL mode of required for PostgreSQL.
libname pg postgres user=myusr1 pwd=mypwd1 server='mysrv.com' 
     port=5432 db=userpg conopts='sslmode=required';&lt;/PRE&gt;&lt;PRE&gt;Tip:	You can also specify any of these additional connection options: DATABASE=, ROLE=, SCHEMA=, and WAREHOUSE=.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 02:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/596143#M17435</guid>
      <dc:creator>AnandVyas</dc:creator>
      <dc:date>2019-10-14T02:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS libname postgres set role option</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/598389#M17482</link>
      <description>&lt;P&gt;&lt;STRONG&gt;DBCONINIT&lt;/STRONG&gt; libname option might be useful also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=p1agt4p0hj4fyun103no9xpgskdv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=acreldb&amp;amp;docsetTarget=p1agt4p0hj4fyun103no9xpgskdv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2019 13:14:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/SAS-libname-postgres-set-role-option/m-p/598389#M17482</guid>
      <dc:creator>ronan</dc:creator>
      <dc:date>2019-10-22T13:14:15Z</dc:date>
    </item>
  </channel>
</rss>

