Untitled
unknown
plain_text
4 years ago
2.2 kB
5
Indexable
# #1 connecting to Power Bi Report Server API ref : https://app.swaggerhub.com/apis/microsoft-rs/PBIRS/2.0#/ # use pip install win32com to install win32com library #!pip install win32com import win32com #url = 'http://mostafalap:801/rp/api/v2.0/PowerBIReports' <<< power bi report server example h = win32com.client.Dispatch('WinHTTP.WinHTTPRequest.5.1') h.SetAutoLogonPolicy(0) #<<< will be replaced with credentials in case of remote access h.Open('GET', url, False) h.Send() result = h.responseText #2 connecting to the SSRS database to get layout file where tables and columns used can be parsed using regular expressions ref : server = 'mostafalap,1433' database = 'report server' username = 'admin' # a user in SSRS database who has username and password password = 'admin' cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password) cursor = cnxn.cursor() select = ''' SELECT itemid,content from dbo.CatalogItemExtendedContent cc where --itemid = '{}' and contenttype = 'PowerBIReportDefinition' ''' # using these connections # metadata is extracted and used to build files needed by EDC custom scanner # to create power bi report server catalog data # a custom edc resource scanner will be used # EDC custom scanner is divided into # #1 model xml file #containing classes -> [Power Bi Reports,....], assocoatiations [powerbiToTable relation, ......] #2 objects file # the objects found on the pbirs is defined here # example # class identity core.name ..... # powerbireport powerbireport_1 report_1 ....... #3 links file # a row example of a table inside a report # associate FromIdentity ToIdentitiy # powerbiToTable powerbireport_1 table.csv # edc API access might be needed in case we wanted to show lineage between power bi reports and other databases
Editor is loading...