Topics Map > Technology > Denodo

Denodo - Creating Data Sources from SharePoint

SharePoint is a platform used at the University of Illinois for storing and sharing documents, which makes it a good places to store documents that you want to integrate with Denodo. However, there are some nuances to be aware of in order to create stable integrations. This document is intended to establish best practices for creating stable integrations between Denodo and SharePoint.

SharePoint integrations use a token-based authentication system called OAuth 2.0. This document will provide instructions for the creation of the SharePoint application and the configuration of OAuth 2.0.

Files

Best Practice: Use CSV files rather than Excel files. CSV files tend to be more stable in Denodo in general and we have also noticed that Excel files accessed over HTTP paths have limitations. Excel limitations can be avoided by converting them to CSV before integrating them with Denodo.

Best Practice: Use the same basic format for all your CSV files. Not only is consistency a good idea, but it will make the SharePoint integration more stable as well. In this document we will standardize on using the comma ( , ) character for the column delimiter, \n for the end of line delimiter, and the first row will have column headers.

The format for interpolation variable sp_path is as follows: /sites/[SiteName]/[DocumentLibrary]/[Folder]/[FileName]

  • [SiteName] is the name of the SharePoint site.
  • [DocumentLibrary] is the name of the document library.
  • [Folder] is the name of the folder.
  • [FileName] is the name of the file.

Notes: Be sure to include the file extension of the file. Your document may not be in a folder. If not, leave that portion out. Your document may also be in a nested folder; in that case repeat that section to give a full path. By default, SharePoint document libraries display as “Documents” yet the name of the actual document library is “Shared Documents."

Creating SharePoint Applications

Screenshot showing the New registration button in Azure

  • Enter a name for the app according to your naming standards in the Name field.
  • For Supported account types, select the Accounts in this organizational directory only option.
  • For the Redirect URI section, select Web as the platform and add the Redirect URI of the environment you'll be using with this app. Due to a SharePoint limitation, the value you set for Redirect URI will be the only one you can use as a redirect URI for this app. Azure supports adding more redirect URIs to an app, but SharePoint only supports one. Be sure you are adding the URI of the Denodo environment you wish to use. The URIs for the different environments in Denodo are listed below:

QA: https://qa.datahub.uillinois.edu:9443/oauth/2.0/redirectURL.jsp Screenshot of the Register an application screen with the fields filled in

Once the app is registered, we will need to grant permissions for clients to access SharePoint using the app.

  • Click Integration assistant.

Screenshot showing location of Intergation Assistant button

  • For What application types are you building?, select Daemon (background process or automation).
  • Click Evaluate my app registration.

Screenshot showing the application type field filled in and the Evaluate my app registration button

API Permissions

  • Under Manage in the menu on the left, click API permissions.

Screenshot showing the location of the API permissions button

  • Click Add a permission.

Screenshot showing the location of the Add a permission button

  • Select SharePoint from the list of Commonly used Microsoft APIs when it opens.

Screenshot of the SharePoint API tile

  • Select Delegated permissions.
  • Under Permission, expand the AllSites menu.
  • Select AllSites.Read.
  • Click Add permissions.

Screenshot showing Delegated permissions and AllSites > AllSites.Read being selected

Certificates & Secrets

  • Under Manage in the left-hand menu, click Certificates & secrets.

Screenshot showing the Certificates & Secrets button

  • Click New client secret.

Screenshot showing the location of the New client secret button

  • Enter a Description.
  • For Expires, select an expiration time frame.

Screenshot showing the description and expiration time frame selected

  • Click Add. You will see that the new client secret has been added to the Client secrets list.
  • Copy and paste the Value (not the Secret ID) of the client secret to a convenient, easily accessible location, such as Keepass.
    NOTE:This is the only time you can view the value of the client secret!
    You will need this value when you create Denodo data source connections using this SharePoint app.

Screenshot showing the location of the Client Secret (blurred for privacy)

  • In the left-hand menu, click Overview.
  • Copy and paste the Application (client) ID to a convenient, easily accessible location, such as Keepass.
    • NOTE: You will need this value when you create Denodo data source connections using this SharePoint app.
  • Copy and paste the Directory (tenant) ID to a convenient, easily accessible location, such as Keepass.
    • NOTE: You will need this value when you create Denodo data source connections using this SharePoint app.

Screenshot showing the location of the Client and Tenant IDs

  • Navigate back to the App Registrations page.
  • Click New registration and create 2 more SharePoint applications - one for the QA environment and one for the Production environment,
  • After creating these three applications, your list of app registrations should include three for Denodo.

Screenshot showing 3 SharePoint apps

Create a Date Source in Denodo

For this document we will use CSV files. In this example we have 3 CSV files of course data, instructor salary data, and awarded grant data.

Best Practice: Only use the SharePoint app credentials in a single Denodo connection. Creating more than one Denodo connection that re-uses the same SharePoint app Client ID will cause the access tokens associated with that Client ID to interrupt one another, and your integration will become unstable.

Since we do not want to use the same SharePoint app credentials for more than one connection, it is a good idea to make the data source reusable. The below instructions show how to make a reusable CSV connection to SharePoint.

  • In Denodo Design Studio, click the context menu for 01 - Data Sources and select New > Data source > Delimited file.

Screenshot showing the path to create a new delimited data source

  • Give the data source a name.
  • For Data route, select HTTP Client.
  • Leave the HTTP method set to GET, and add the following URL to the Base URL field.

https://uillinoisedu.sharepoint.com/sites/[SiteName]/_api/Web/GetFileByServerRelativePath(decodedurl='@sp_path')/$value

[SiteName] will be the name of the SharePoint site you have access to. For example, if my SharePoint site was named FAA Enrollment Data, the URL would be https://uillinoisedu.sharepoint.com/sites/FAAEnrollmentData/_api/Web/GetFileByServerRelativePath(decodedurl='@sp_path')/$value

The link above uses an interpolation variable for sp_path (SharePoint path), which is what will make this connection reusable.

Screenshot showing the name, data route and base URL fields filled in

  • Expand the Authentication section, and select OAuth 2.0 from the Authorization options.
  • Leave the Authorization Grant value set to Authorization code grant, and paste the Client identifier and Client secret from your SharePoint app in their respective fields.

Screenshot showing the client ID and client secret fields filled in

  • Click the link titled Launch the OAuth 2.0 credentials wizard to help you obtain these credentials, which should now be enabled. If the link is not enabled, go to the Tools tab at the top right and select OAuth credentials wizards > OAuth 2.0 wizard.

Screenshot of the link

  • Populate the Token endpoint URL and the Authorization server URL fields with the following values.

Token endpoint URL: https://login.microsoftonline.com/common/oauth2/token

Authorization server URL: https://login.microsoftonline.com/common/oauth2/authorize?resource=https%3A%2F%2Fuillinoisedu.sharepoint.com

  • For Redirect URI, select the Other radio button and populate that field with one of the following redirect URIs, based on which environment you're working with.

QA: https://qa.datahub.uillinois.edu:9443/oauth/2.0/redirectURL.jsp Screenshot showing the URL and Scope fields populated

  • Expand 2. Generate the Authorization URL, click the Generate link to populate the Authorization URL field, and then click the Open URL link.

Screenshot showing the authorization URL being generated

  • If a web page opens asking for Permission requested, click Accept.
  • Copy the URL on line 3 of the web page that opens.

Screenshot showing the response URL

  • Expand 3. Paste the authorization response URL and paste the link you just copied.
  • Expand 4. Obtain the OAuth 2.0 credentials and click the OAuth 2.0 credentials link.

Screenshot showing the location of the Generate OAuth credentials button

  • You should receive the following confirmation that the OAuth 2.0 credentials were obtained.

Confirmation that the OAuth 2.0 credentials have been successfully obtained

  • Click the Copy credentials to the clipboard link, and then click OK.
  • Scroll down to the Column delimiter field and add a comma ( , ), and check the box next to Header.

Screenshot of last section of the OAuth 2.0 credentials wizard showing the delimiter and header options

  • Click Save.
  • Once the data source is saved, we can click Test Connection, which will bring up an Interpolation variable screen where we'll need to enter the sp_path for the first CSV file in SharePoint. See the Files section above to learn how to obtain these sp_path values. Click OK.

Screenshot showing the data source was successfully tested

Best practice: Once your connection is initially tested, avoid using the “Test Connection” feature. We have found that doing so could introduce an issue with the authentication.

Create Base Views

In this document we will create 3 base view to illustrate how to reuse the box data source for multiple CSV files.

  • Open the Data Source created above and click the Create Base View link.

Screenshot of the Create base view link

  • You will be prompted for a value for sp_path. See the Files section above for the correct format of the sp_path variable. Enter the sp_path of the first CSV file and click Ok.

Screenshot showing the Interpolation variable screen with the @sp_path variable populated

  • In the context menu for the base view we just created, select Rename and give the base view a new name.
  • Drag the base view from the 01 - Connectivity / 01 - Data Sources folder to the 01 - Connectivity / 02 - Base Views folder.
  • Repeat the steps above to create base views for the other two CSV files. When complete, you should have one data source and three base views.

Screenshot showing the SharePoint data source and 3 base views

Create Derived Views that Encode the File IDs in the View

There is one aspect of this solution to make the data source reusable that is a little annoying. If we were to execute these base views, we would be prompted for the File ID each time. If we use the wrong File ID, our query may not return any data. We can take care of that by creating integrated views of these base views.

There are a few ways to accomplish creating these integrated views.

  • Using the GUI
    • In the context menu for the base view, select New > Selection.
    • On the Where Conditions tab, enter [Base View Name].sp_path = [sp_path value]

Screenshot of Design Studio Where conditions tab showing the wher condition entered

  • Using a VQL script
    • Run the following script in the VQL Shell to create the integrated view. Note: your integrated view name, folder names, base view name and sp_path value will be unique to your data source.

CREATE OR REPLACE VIEW iv_sharepoint_csvs_course_schedule_data FOLDER = ' / ahall1 / 02 - Integration'

AS

select * from bv_sharepoint_csvs_course_schedule_data where sp_path = '/sites/TestSiteforDenodoImplementation/Shared%20Documents/New/Course_Schedule_data.csv';

 

Now, we can query these integrated views directly, without having to enter a File ID each time.

Note: You may need to click the File tab at the top and select Refresh to see the new integrated views you just created.

Screenshot showing the SharePoint data source, 3 base views and 3 integrated views



Keywords:
Datahub 
Doc ID:
142564
Owned by:
Alex H. in UI Training and Development Resources
Created:
2024-09-20
Updated:
2024-10-23
Sites:
University of Illinois Training and Development Resources