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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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