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
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')
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 @.
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.
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.
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.