Let’s understand the process of connecting Power BI to a TigerGraph database, visualizing the GSQL output using the REST API endpoints, and using the token for authentication in a step-by-step manner:
Step 1: Install Required Libraries
To begin, you need to install the necessary Python library for working with TigerGraph:
!pip install pyTigerGraph
Step 2: Import Required Libraries
Next, import the required libraries in your Python script:
import pyTigerGraph as tg
import json
import pandas as pd
Step 3: Set Up Connection Parameters
Define the connection parameters for your TigerGraph database:
hostName = “https://b50b664e1111yourhostname.i.tgcloud.io"
graphName = “your_graph_name”
secret = "cseupuua70ol1seg*qv5sg”
userName = “your_username”
password = your_password"
(please note all above things are will be available in your tg cluster try to explore it so that you will get to know where these are available )
Step 4: Create Connection to TigerGraph
Establish a connection to TigerGraph using the specified parameters:
conn = tg.TigerGraphConnection(host=hostName, username=userName, password=password)
Step 5: Generate and Obtain the Token
Generate a token for authentication using the secret key:
token = conn.getToken(secret)
print(token)
Step 6: Install and Write GSQL Queries
Write the GSQL queries that you want to visualize in Power BI.
Step 7: Set Up REST API Endpoints
Once you have the GSQL queries, you need to set up the REST API endpoints in TigerGraph.
Step 8: Import Data in Power BI
In Power BI, go to “Get Data” and select “Web” as the data source. Click “Advanced” to enter the REST API endpoint URL.
Step 9: Configure REST API Request
In the Web dialog, enter the REST API endpoint URL and include the necessary parameters (e.g., query parameters) if required. Add the token obtained in Step 5 as an authentication header in the request
Step 10: Import Data into Power BI
Click “OK” to import the data from the TigerGraph database into Power BI.
Step 11: Visualize Data in Power BI
Once the data is imported, you can use Power BI’s visualization tools to create interactive and insightful visualizations based on the GSQL query results.
By following these steps, you can connect Power BI to your TigerGraph database, import data using REST API endpoints, and authenticate the request using the token. This allows you to create compelling visualizations based on the GSQL query outputs using the power of both Power BI and TigerGraph.
for more info follow this link :Bring Your TigerGraph Data to Life with Microsoft Power BI | by Ahlem Mustapha | Medium
hope this will help you thank you