带有Python的SAS IOM桥

时间:2018-08-21 09:46:15

标签: python com sas win32com sas-stored-process

我正在使用IOM Bridge连接到远程SAS Workspace服务器:

import win32com.client

objFactory = win32com.client.Dispatch("SASObjectManager.ObjectFactoryMulti2")

objServerDef = win32com.client.Dispatch("SASObjectManager.ServerDef")
objServerDef.MachineDNSName = "servername"
objServerDef.Port = 8591    # workspace server port
objServerDef.Protocol = 2   # 2 = IOM protocol
objServerDef.BridgeSecurityPackage = "Username/Password"
objServerDef.ClassIdentifier = "workspace server id"

objSAS = objFactory.CreateObjectByServer("SASApp", True, objServerDef, "uid", "pw")

program = "ods listing;proc means data=sashelp.cars mean mode min max; run;"

objSAS.LanguageService.Submit(program)

_list = objSAS.LanguageService.FlushList(999999)
print(_list)

log = objSAS.LanguageService.FlushLog(999999)
print(log)

objSAS.Close()

工作正常。但是当尝试使用存储过程服务器时(当我更改“ Port”和“ ClassIdentifier”时),我似乎找不到CreateObjectByServer的正确属性:

import win32com.client

objFactory = win32com.client.Dispatch("SASObjectManager.ObjectFactoryMulti2")

objServerDef = win32com.client.Dispatch("SASObjectManager.ServerDef")
objServerDef.MachineDNSName = "servername"
objServerDef.Port = 8601    # stored process server port
objServerDef.Protocol = 2   # 2 = IOM protocol
objServerDef.BridgeSecurityPackage = "Username/Password"
objServerDef.ClassIdentifier = "stp server id"

objSAS = objFactory.CreateObjectByServer("SASApp", True, objServerDef, "uid", "pw")

objSAS.StoredProcessService.Repository("path", "stp", "params")

_list = objSAS.LanguageService.FlushList(999999)
print(_list)

log = objSAS.LanguageService.FlushLog(999999)
print(log)

objSAS.Close()

尝试以上操作时,我得到:

AttributeError: CreateObjectByServer.StoredProcessService

我似乎找不到太多有关存储过程服务器的IOM文档。任何人有任何建议吗?

0 个答案:

没有答案