BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
supp
Pyrite | Level 9

Using saspy I am trying to connect to a teradata server using the saslib method. I have my username and password stored in a credentials file that I am referencing from an import statement and storing username and password as a python object.

 

When I reference username and password in the saslib method one of the symbols in my password appears to be escaping the string and trying to resolve. The special character is the '@' symbol. Is there a way to fix this?

 

I am using python 3.5.2 in a UNIX environmet and sas 9.4 on the grid

 

Code:

import saspy
from CONFIG.sasconfig import username, password

sas = saspy.SASsession(omruser=username, omrpw=password, cfgname='configname')

sas.saslib('rpt', engine='Teradata', options='user='+username+' pw='+password+' server=server1 schema=schema1')

error:

libname rpt Teradata user=myusername pw=XXXX@XXXX server=server1 schema=schema1;
                                            _
                                            22
ERROR: Libref RPT is not assigned.
ERROR: Error in the LIBNAME statement.
ERROR 22-7: Invalid option name @.
1 ACCEPTED SOLUTION

Accepted Solutions
sastpw
SAS Employee

Hey, I think you can just quote the pw and it ought to work. Give this a try:

 

sas.saslib('rpt', engine='Teradata', options='user='+username+' pw="'+password+'" server=server1 schema=schema1')

 

Hopefully that's all you need.

Tom 

View solution in original post

3 REPLIES 3
JackHamilton
Lapis Lazuli | Level 10

I replied, but it seems to have gone into the ether.

 

You need to put the password in quotes.  You can probably just put double quotes inside the existing single quotes; in SAS you would use quote(trim(password)), but I don't know the Python equivalent.

 
You're on a grid system?  Consider using an authdomain instead.
 

 

 

 

sastpw
SAS Employee

Hey, I think you can just quote the pw and it ought to work. Give this a try:

 

sas.saslib('rpt', engine='Teradata', options='user='+username+' pw="'+password+'" server=server1 schema=schema1')

 

Hopefully that's all you need.

Tom 

supp
Pyrite | Level 9

That did the trick! Thanks for the help.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2258 views
  • 1 like
  • 3 in conversation