Exporting task data to Power BI/Tableau

Hey Folks,

Anyone here with experience generating reports in power BI or tableau, where the data can be pulled directly from shotgrid via API? I am looking at generating task level reports for now.

Cheers
Rohit

2 Likes

Bumping this because we have a similar need. Thanks

I’m not sure if power bi can run python scripts or if it can connect to ShotGrid’s REST api?
If not the above then one could create a bridge using something like FastAPI or Flask and connect powerBI to that, which in turn can talk to ShotGrid.

You can use Python as a data source in PowerBI. Use the Pandas library to output a dataframe. Here’s a code snippet that I used to plot project locations on a map in Power BI:

import pandas
import shotgun_api3

sg = shotgun_api3.Shotgun('<server_name>',
                          script_name='<script_name>',
                          api_key='<api_key>')
if sg is not None:
    fields = ['name', 'sg_latitude',
              'sg_longitude', 'sg_status', 'sg_type']
    filters = [
        ['sg_latitude', 'is_not', None],
        ['sg_longitude', 'is_not', None],
        {
            'filter_operator': 'any',
            'filters': [
                ['sg_status', 'is', 'Active'],
                ['sg_status', 'is', 'Bidding'],
                ['sg_status', 'is', 'Complete'],
                ['sg_status', 'is', 'Hold'],
                ['sg_status', 'is', 'Lead']
            ]
        }
    ]
    project_data = sg.find('Project', filters, fields)
    project_array = []
    for project in project_data:
        project_array.append(
            [project['name'],
             project['sg_latitude'],
             project['sg_longitude'],
             project['sg_status'],
             project['sg_type']
             ])
    bi_data = pandas.DataFrame(project_array,
                               columns=['ProjectName', 'Latitude',
                                        'Longitude', 'Status', 'Type']
                               )
    print(bi_data)
2 Likes