Last active
August 29, 2015 14:14
-
-
Save marcusrehm/7a310c8794ad7306f119 to your computer and use it in GitHub Desktop.
Script to process Analysis Services cubes (over XMLA) from Oracle Data Integrator procedures. Procedure options "SSAS_URL", "SSAS Database", "Cube", "Processing Option" must be created before use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import urllib2 | |
url = '<%=odiRef.getContext("SSAS_URL")%>' | |
data = '<?xml version="1.0"?><Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">' + | |
'<Body>' + | |
'<Execute xmlns="urn:schemas-microsoft-com:xml-analysis"><Command>' + | |
'<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">' + | |
'<Parallel>' + | |
'<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400">' + | |
'<Object> <DatabaseID><%=snpRef.getOption("SSAS Database")%></DatabaseID>' + | |
'<CubeID><%=snpRef.getOption("Cube")%></CubeID>' + | |
'</Object>' + | |
'<Type><%=snpRef.getOption("Processing Option")%></Type>' + | |
'<WriteBackTableCreation>UseExisting</WriteBackTableCreation>' + | |
'</Process>' + | |
'</Parallel>' + | |
'</Batch>' + | |
'</Command>' + | |
'<Properties><PropertyList></PropertyList> </Properties>' + | |
'</Execute>' + | |
'</Body></Envelope>' | |
http_headers = {"Content-Type":'text/xml; charset="UTF-8"; application/xml', 'SOAPAction':'urn:schemas-microsoft-com:xml-analysis:Execute'} | |
request_object = urllib2.Request(url, data, http_headers) | |
response = urllib2.urlopen(request_object) | |
html_string = response.read() | |
if len(html_string) != 367 : | |
raise html_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment