BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ChrisNZ
Tourmaline | Level 20

I'm trying to retrieve which user ID was used to allocate a Hadoop library.

 

I couldn't find a way so thought this could be stored in the comment field at allocation time.

See table SASHELP.VLIBNAM

ChrisNZ_0-1663828290474.png

Any idea on either retrieving the userid used in the libname statement, or on populating the value for comment ?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Perhaps.  What does the documentation say about that COMMENT option?

 

But why not just remember what userid you used when you defined the libref to begin with?

 

Or ask HIVE to tell you.  Most SQL implementations support the keyword USER. 

SAS does.

proc sql;
  select user into :userid from sashelp.class(obs=1);
quit;

So try something similar in a pass thru query to HIVE.

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Perhaps.  What does the documentation say about that COMMENT option?

 

But why not just remember what userid you used when you defined the libref to begin with?

 

Or ask HIVE to tell you.  Most SQL implementations support the keyword USER. 

SAS does.

proc sql;
  select user into :userid from sashelp.class(obs=1);
quit;

So try something similar in a pass thru query to HIVE.

ChrisNZ
Tourmaline | Level 20

The documentation does not say anything about this field as far as I could see.

 

Good point about using native commands. This works:

 

select * from connection to HIVE (select current_user() );

or
select * from connection to HIVE (select logged_in_user() );

 

Thank you Tom.

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 496 views
  • 0 likes
  • 2 in conversation