OneDrive Connector for Alteryx : Read JSON file (generic) via SQL

Integrate Alteryx and OneDrive
Integrate Alteryx and OneDrive

Learn how to read JSON file (generic) using the OneDrive Connector for Alteryx. This connector enables you to read and write Microsoft OneDrive data effortlessly. Integrate, manage, and automate files and folders — almost no coding required. We'll walk you through the exact setup.

Let's dive in!

Create data source using OneDrive ODBC Driver

  1. Download and install ODBC PowerPack (if you haven't already).

  2. Search for odbc and open the ODBC Data Sources (64-bit):

    Open ODBC Data Source
  3. Create a User data source (User DSN) based on the ZappySys API Driver driver:

    ZappySys API Driver
    Create new User DSN for ZappySys API Driver
    • Create and use a User DSN if the client application runs under a User Account. This is the ideal option at design time (e.g., when developing in Visual Studio). Use it for both types of applications (64-bit and 32-bit).
    • Create and use a System DSN if the client application runs under a System Account (e.g., as a Windows Service). This is usually the required option in a production environment. If your Windows Service is a 32-bit application, you must use the 32-bit ODBC Data Source Administrator to configure this
  4. When the Configuration window appears give your data source a name if you haven't done that already, then select "OneDrive" from the list of Popular Connectors. If "OneDrive" is not present in the list, then click "Search Online" and download it. Then set the path to the location where you downloaded it. Finally, click Continue >> to proceed with configuring the DSN:

    OnedriveDSN
    OneDrive
    ODBC DSN Template Selection
  5. Now it's time to configure the Connection Manager. Select Authentication Type, e.g. Token Authentication. Then select API Base URL (in most cases, the default one is the right one). More info is available in the Authentication section.

    OneDrive authentication

    Use delegated access (User Credentials) whenever you want to let a signed-in user work with their own resources or resources they can access. Whether it's an admin setting up policies for their entire organization or a user deleting an email in their inbox, all scenarios involving user actions should use delegated access. [API reference]

    Follow these simple steps below to create Microsoft Entra ID application with delegated access:

    WARNING: To automate your company's processes, make sure you use a system/generic account (e.g. automation@my-company.com). When you use a personal account which is tied to a specific employee profile and that employee leaves the company, the token may become invalid and any automated processes using that token will start to fail.
    1. Navigate to the Azure Portal and log in using your credentials.
    2. Access Microsoft Entra ID.
    3. Register a new application by going to App registrations and clicking on New registration button: Start new app registration in Microsoft Entra ID
      INFO: Find more information on how to register an application in Graph API reference.
    4. When configuration window opens, configure these fields:
      • Supported account type
        • Use Accounts in this organizational directory only, if you need access to data in your organization only.
      • Redirect URI:
        • Set the type to Public client/native (mobile & desktop).
        • Use https://zappysys.com/oauth as the URL.
      Register app in Microsoft Entra ID
    5. After registering the app, copy the Application (client) ID for later: Copy client ID of Microsoft Entra ID app
    6. Then copy OAuth authorization endpoint (v2) & OAuth token endpoint (v2) URLs to use later in the configuration: Copy Auth and Token URLs in Microsoft Entra ID app
    7. Now go to SSIS package or ODBC data source and use the copied values in User Credentials authentication configuration:
      • In the Authorization URL field paste the OAuth authorization endpoint (v2) URL value you copied in the previous step.
      • In the Token URL field paste the OAuth token endpoint (v2) URL value you copied in the previous step.
      • In the Client ID field paste the Application (client) ID value you copied in the previous step.
      • In the Scope field use the default value or select individual scopes, e.g.:
        • email
        • offline_access
        • openid
        • profile
        • User.Read
        • Files.Read.All
        • Files.ReadWrite.All
    8. Press Generate Token button to generate Access and Refresh Tokens.
    9. Optional step. Choose Default Drive Id from the drop down menu.
    10. Click Test Connection to confirm the connection is working.
    11. Done! Now you are ready to use the API Connector!
    API Connection Manager configuration

    Just perform these simple steps to finish authentication configuration:

    1. Set Authentication Type to User Credentials [OAuth]
    2. Optional step. Modify API Base URL if needed (in most cases default will work).
    3. Fill in all the required parameters and set optional parameters if needed.
    4. Press Generate Token button to generate the tokens.
    5. Finally, hit OK button:
    OnedriveDSN
    OneDrive
    User Credentials [OAuth]
    https://graph.microsoft.com/v1.0
    Required Parameters
    Authorization URL Fill-in the parameter...
    Token URL Fill-in the parameter...
    Client ID Fill-in the parameter...
    Scope Fill-in the parameter...
    Optional Parameters
    Client Secret
    Refresh Token File Path
    Return URL https://zappysys.com/oauth
    Default Group or User Id (additional Scopes needed to list - If fails enter manually)
    Default Drive Id (Select after clicking **Generate Token**) me
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 429|503|423
    RetryCountMax 5
    RetryMultiplyWaitTime True
    Login Prompt Option
    Search Option For Non-Indexed Fields (Default=Blank - Search Only Indexed)
    Extra Headers (e.g. Header1:AAA||Header2:BBB)
    IsAppCred 0
    ODBC DSN OAuth Connection Configuration
    OneDrive authentication

    Application-only access is broader and more powerful than delegated access (User Credentials), so you should only use app-only access where needed. Use it when: 1. The application needs to run in an automated way, without user input (for example, a daily script that checks emails from certain contacts and sends automated responses). 2. The application needs to access resources belonging to multiple different users (for example, a backup or data loss prevention app might need to retrieve messages from many different chat channels, each with different participants). 3. You find yourself tempted to store credentials locally and allow the app to sign in 'as' the user or admin. [API reference]

    Follow these simple steps below to create Microsoft Entra ID application with application access permissions. Using following steps, you can grant very granular app permissions to access File(s). Choose permission based on your need.

    Create OAuth app

    1. Navigate to the Azure Portal and log in using your credentials.
    2. Access Microsoft Entra ID.
    3. Register a new application by going to App registrations and clicking on New registration button: Start new app registration in Microsoft Entra ID
      INFO: Find more information on how to register an application in Graph API reference.
    4. When configuration window opens, configure these fields:
      • Supported account type
        • e.g. select Accounts in this organizational directory only if you need access to data in your organization only.
      • Redirect URI:
        • Set the type to Public client/native (mobile & desktop).
        • Leave the URL field empty.
      Register app in Microsoft Entra ID
    5. After registering the app, copy the Application (client) ID for later: Copy client ID of Microsoft Entra ID app
    6. Then copy OAuth authorization endpoint (v2) & OAuth token endpoint (v2) URLs: Copy Auth and Token URLs in Microsoft Entra ID app
    7. Continue and create Client secret: Add Client secret for Microsoft Entra ID app
    8. Then copy the Client secret for later steps: Copy Client secret
    9. Continue by adding permissions for the app by going to the API permissions section, and clicking on Add a permission: Start adding permissions to Microsoft Entra ID app
    10. Select Microsoft Graph: Select Graph API permissions for Microsoft Entra ID app
    11. Then choose Application permissions option: Select app permissions for Microsoft Entra ID app
    12. Continue by adding these Files (OneDrive) permissions (Just search for "Files" and then select desired permissions): Select OneDrive scopes
    13. Finish by clicking Add permissions button: Add permissions to Microsoft Entra ID app
    14. Now it's time to Grant admin consent for your application: Grant admin consent for Microsoft Entra ID app
    15. Confirm all the permissions are granted: Admin consent granted successfully in Entra ID
    16. Now go to SSIS package or ODBC data source and use the copied values in Application Credentials authentication configuration:
      • In the Token URL field paste the OAuth token endpoint (v2) URL value you copied in the previous step.
      • In the Client ID field paste the Application (client) ID value you copied in the previous step.
      • In the Client Secret field paste the Client secret value you copied in the previous step.
      • Optional step. Choose Default Drive Id from the drop down menu.
    17. Click Test Connection to confirm the connection is working.
    API Connection Manager configuration

    Just perform these simple steps to finish authentication configuration:

    1. Set Authentication Type to Application Credentials [OAuth]
    2. Optional step. Modify API Base URL if needed (in most cases default will work).
    3. Fill in all the required parameters and set optional parameters if needed.
    4. Finally, hit OK button:
    OnedriveDSN
    OneDrive
    Application Credentials [OAuth]
    https://graph.microsoft.com/v1.0
    Required Parameters
    Token URL Fill-in the parameter...
    Client ID Fill-in the parameter...
    Client Secret Fill-in the parameter...
    Default Group or User Id (additional Scopes needed to list - If fails enter manually) Fill-in the parameter...
    Default Drive Id Fill-in the parameter...
    Optional Parameters
    Scope https://graph.microsoft.com/.default
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 429|503|423
    RetryCountMax 5
    RetryMultiplyWaitTime True
    Search Option For Non-Indexed Fields (Default=Blank - Search Only Indexed)
    Extra Headers (e.g. Header1:AAA||Header2:BBB)
    IsAppCred 1
    ODBC DSN OAuth Connection Configuration
    OneDrive authentication

    Similar to Assplication-only access but with JWT sign with Private Key [API reference]

    Follow these simple steps below to create Microsoft Entra ID application with application access permissions. Using following steps, you can grant very granular app permissions to access File(s). Choose permission based on your need.

    Create OAuth app

    1. Navigate to the Azure Portal and log in using your credentials.
    2. Access Microsoft Entra ID.
    3. Register a new application by going to App registrations and clicking on New registration button: Start new app registration in Microsoft Entra ID
      INFO: Find more information on how to register an application in Graph API reference.
    4. When configuration window opens, configure these fields:
      • Supported account type
        • e.g. select Accounts in this organizational directory only if you need access to data in your organization only.
      Register app in Microsoft Entra ID
    5. After registering the app, copy the Application (client) ID for later: Copy client ID of Microsoft Entra ID app
    6. Then copy OAuth authorization endpoint (v2) & OAuth token endpoint (v2) URLs: Copy Auth and Token URLs in Microsoft Entra ID app

    Configure App Permissions

    1. Continue by adding permissions for the app by going to the API permissions section, and clicking on Add a permission: Start adding permissions to Microsoft Entra ID app
    2. Select Microsoft Graph: Select Graph API permissions for Microsoft Entra ID app
    3. Then choose Application permissions option: Select app permissions for Microsoft Entra ID app
    4. Continue by adding these Files (OneDrive) permissions (Just search for "Files" and then select desired permissions): Select OneDrive scopes
    5. Finish by clicking Add permissions button: Add permissions to Microsoft Entra ID app
    6. Now it's time to Grant admin consent for your application: Grant admin consent for Microsoft Entra ID app
    7. Confirm all the permissions are granted: Admin consent granted successfully in Entra ID

    Generate a Self-Signed Certificate

    Now let's go through setting up a certificate-based authentication flow for Microsoft Graph or other Azure AD protected APIs using client credentials and a JWT.

    You can use OpenSSL or any other way to generate Certificate file but to make it simple we will use below example PowerShell script.

    Open PowerShell and execute code listed in below steps.

    
    # Run this in PowerShell
    #Change .AddYears(1) to desired number. By default it expires certificate in one year as per below code.
    
    $cert = New-SelfSignedCertificate `
      -Subject "CN=MyClientAppCert" `
      -KeySpec Signature `
      -KeyExportPolicy Exportable `
      -KeyLength 2048 `
      -CertStoreLocation "Cert:\CurrentUser\My" `
      -KeyAlgorithm RSA `
      -HashAlgorithm SHA256 `
      -NotAfter (Get-Date).AddYears(1) `
      -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider"
    
    # Export private key (.pfx)  - Keep this with you to make API calls (SECRET KEY - DONOT SHARE)
    $pfxPath = "$env:USERPROFILE\Desktop\private_key.pfx"
    $pwd = ConvertTo-SecureString -String "yourStrongPassword123" -Force -AsPlainText
    Export-PfxCertificate -Cert $cert -FilePath $pfxPath -Password $pwd
    
    # Export public certificate (.cer) - UPLOAD this to Azure Portal
    $cerPath = "$env:USERPROFILE\Desktop\public_key.cer"
    Export-Certificate -Cert $cert -FilePath $cerPath
    

    Upload the Certificate (i.e. Public Key *.cer)

    Once we have certificate file generated.
    1. In your App Registration, go to Certificates & secrets
    2. Under Certificates, click Upload certificate
    3. Select the .cer file (public certificate) Upload public key (certificate file) for App-Credentials (JWT Auth)
    4. Click Select a file (Browse button)
    5. Select public key file (*.cer) from local machine and click OK to upload

    Configure ZappySys Connection - Use private key (i.e. *.pfx or *.pem)

    Now its time to use certificate pfx file (private key) generated in the previous step (NOTE: PFX file contains both private key and public key).
    1. Go to SSIS package or ODBC data source and use the copied values in Application Credentials authentication configuration:
      • In the Token URL field paste the OAuth token endpoint (v2) URL value you copied in the previous step.
      • In the Client ID field paste the Application (client) ID value you copied in the previous step.
    2. Configure private key
      • go to Certificate Tab
      • Change Storage Mode to Disk File: *.pfx format (PKCS#12).

        NOTE: You can also use Stored In LocalMachine mode if PFX file already imported in the Local Certificate Storage Area - User Store OR Machine Store.

        If you used OpenSSL to generate key pair then use Disk File: *.pem format (PKCS#8 or PKCS#1) Mode for Cert Store Location.

      • Supply the key file path
      • Supply the certificate password (same password used in earlier PowerShell script)
    3. Now go back to General Tab, choose Default Group / User Id and Default Drive Id from the drop down menu.
    4. Click Test connection see everything is good
    API Connection Manager configuration

    Just perform these simple steps to finish authentication configuration:

    1. Set Authentication Type to Application Credentials with Certificate (Sign JWT with Private Key) [OAuth]
    2. Optional step. Modify API Base URL if needed (in most cases default will work).
    3. Fill in all the required parameters and set optional parameters if needed.
    4. Finally, hit OK button:
    OnedriveDSN
    OneDrive
    Application Credentials with Certificate (Sign JWT with Private Key) [OAuth]
    https://graph.microsoft.com/v1.0
    Required Parameters
    Token URL Fill-in the parameter...
    Client ID Fill-in the parameter...
    Certificate: *** Configure [Client Certificate] Tab *** Fill-in the parameter...
    Default Group or User Id (additional Scopes needed to list - If fails enter manually) Fill-in the parameter...
    Default Drive Id Fill-in the parameter...
    Optional Parameters
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 429|503|423
    RetryCountMax 5
    RetryMultiplyWaitTime True
    Search Option For Non-Indexed Fields (Default=Blank - Search Only Indexed)
    Extra Headers (e.g. Header1:AAA||Header2:BBB)
    IsAppCred 1
    ODBC DSN OAuth Connection Configuration

  6. Then go to Preview tab to start building a SQL query.

  7. Once you do that, proceed by opening Query Builder:

    ZappySys API Driver - OneDrive
    Read and write Microsoft OneDrive data effortlessly. Integrate, manage, and automate files and folders — almost no coding required.
    OnedriveDSN
    Open Query Builder in API ODBC Driver to read and write data to REST API
  8. Then simply select the Read JSON File (Generic) endpoint (action).

  9. Continue by configuring the Required parameters. You can also set optional parameters too.

  10. Move on by hitting Preview Data button to preview the results.

  11. If you see the results you need, simply copy the generated query:

    Read JSON File (Generic)
    Required Parameters
    Drive Id / Shared Folder Select the value from the dropdown
    File Id or Path (e.g. root:/somefolder/myfile.xyz: ) - Max 1000 Listed Select the value from the dropdown
    Optional Parameters
    Default Group or User Id (additional Scopes needed to list - If fails enter manually)
    Search Type (For UI Only - Default=Recursive - i.e. Blank)
    Search Folder (For UI Only - Helps to narrow down File Selection DropDown) - Max 200 Listed
    Advanced Properties
    DataFormat Notset
    Continue On 404 Error (When item not found) True
    Filter
    ExcludedProperties
    Encoding
    CharacterSet
    EnableCustomReplace
    SearchFor
    ReplaceWith
    EnableArrayFlattening
    MaxArrayItemsToFlatten
    ArrayTransformType
    ArrayTransColumnNameFilter
    ArrayTransRowValueFilter
    ArrayTransEnableCustomColumns
    ArrayTransCustomColumns
    EnablePivot
    FileCompressionType None
    DateFormatString
    SELECT * from get_json_file
    WITH(
    	  DriveId='b!0zqXLXXJh0uUMzl-JXAd9Ztngc-5utVDqRyD2lKpD2535-11HLQTR5z4hOzmA7Q0'
    
    	, FileId='root:/myfolder/dump.json:' --Path must end with colon
      --, FileId='01N3NI7YRUO2UHV2TUMBGJ4H4QQMWCG6DA'		
      
      --to read compressed file use below way
      --, FileId='root:/myfolder/dump.json.gz:' --Path must end with colon
      --, FileCompressionType='GZip' --None, GZip, Zip
      
        , Filter='$.store.books[*]' --or just blank (see help file for more filter examples)
    	
    )         
    
    --SELECT * FROM get_json_file WITH(FileId='01N3NI7YQJMKXUWUAQGJEJJJNSGVT7QSJ3')
    --SELECT * FROM get_json_file WITH(FileId='root:/dump.json:') --Path must end with colon
    --SELECT * FROM get_json_file WITH(FileId='root:/Documents/dump.json:') --Path must end with colon
    --SELECT * FROM get_json_file WITH(FileId='root:/Documents/SubFolder/dump.json:') --Path must end with colon
    Query Builder
  12. Click OK to use built SQL query and close the Query Builder.

  13. Now hit Preview Data button to preview the data using the generated SQL query. If you are satisfied with the result, use this query in Alteryx:

    ZappySys API Driver - OneDrive
    Read and write Microsoft OneDrive data effortlessly. Integrate, manage, and automate files and folders — almost no coding required.
    OnedriveDSN
    SELECT * from get_json_file
    WITH(
    	  DriveId='b!0zqXLXXJh0uUMzl-JXAd9Ztngc-5utVDqRyD2lKpD2535-11HLQTR5z4hOzmA7Q0'
    
    	, FileId='root:/myfolder/dump.json:' --Path must end with colon
      --, FileId='01N3NI7YRUO2UHV2TUMBGJ4H4QQMWCG6DA'		
      
      --to read compressed file use below way
      --, FileId='root:/myfolder/dump.json.gz:' --Path must end with colon
      --, FileCompressionType='GZip' --None, GZip, Zip
      
        , Filter='$.store.books[*]' --or just blank (see help file for more filter examples)
    	
    )         
    
    --SELECT * FROM get_json_file WITH(FileId='01N3NI7YQJMKXUWUAQGJEJJJNSGVT7QSJ3')
    --SELECT * FROM get_json_file WITH(FileId='root:/dump.json:') --Path must end with colon
    --SELECT * FROM get_json_file WITH(FileId='root:/Documents/dump.json:') --Path must end with colon
    --SELECT * FROM get_json_file WITH(FileId='root:/Documents/SubFolder/dump.json:') --Path must end with colon
    API ODBC Driver-based data source data preview
    You can also access data quickly from the tables dropdown by selecting <Select table>.
    A WHERE clause, LIMIT keyword will be performed on the client side, meaning that the whole result set will be retrieved from the OneDrive API first, and only then the filtering will be applied to the data. If possible, it is recommended to use parameters in Query Builder to filter the data on the server side (in OneDrive servers).

Let's not stop here and explore SQL query examples, including how to use them in Stored Procedures and Views (virtual tables) in the next steps.

OneDrive SQL query examples

Use these SQL queries in your Alteryx data source:

Read JSON file (streaming, no download)

Gets JSON file content without downloading to disk (streaming). Supply DriveId and FileId (path must end with colon). For compressed files set FileCompressionType to GZip or Zip.

SELECT * from get_json_file
WITH(
	  DriveId='b!0zqXLXXJh0uUMzl-JXAd9Ztngc-5utVDqRyD2lKpD2535-11HLQTR5z4hOzmA7Q0'

	, FileId='root:/myfolder/dump.json:' --Path must end with colon
  --, FileId='01N3NI7YRUO2UHV2TUMBGJ4H4QQMWCG6DA'		
  
  --to read compressed file use below way
  --, FileId='root:/myfolder/dump.json.gz:' --Path must end with colon
  --, FileCompressionType='GZip' --None, GZip, Zip
  
    , Filter='$.store.books[*]' --or just blank (see help file for more filter examples)
	
)         

--SELECT * FROM get_json_file WITH(FileId='01N3NI7YQJMKXUWUAQGJEJJJNSGVT7QSJ3')
--SELECT * FROM get_json_file WITH(FileId='root:/dump.json:') --Path must end with colon
--SELECT * FROM get_json_file WITH(FileId='root:/Documents/dump.json:') --Path must end with colon
--SELECT * FROM get_json_file WITH(FileId='root:/Documents/SubFolder/dump.json:') --Path must end with colon

Read compressed JSON file (Zip/Gzip, streaming)

Gets a compressed JSON file (Zip or Gzip) without downloading to disk. Set FileCompressionType and supply FileId (path to the .zip or .gz file).

SELECT * from get_json_file
WITH(
	DriveId='b!0zqXLXXJh0uUMzl-JXAd9Ztngc-5utVDqRyD2lKpD2535-11HLQTR5z4hOzmA7Q0'
  , FileId='root:/myfolder/dump.json.zip:' --Path must end with colon
--, FileId='01N3NI7YRUO2UHV2TUMBGJ4H4QQMWCG6DA'
  , Filter='$.store.books[*]' --or just blank (see help file for more filter examples)
  , FileCompressionType='Zip' --None, GZip, Zip
)

get_json_file endpoint belongs to FileReaderWriterJson table(s), and can therefore be used via those table(s).

Create SQL view in ODBC data source

ZappySys API Drivers support flexible Query language so you can override Default Properties you configured on Data Source such as URL, Body. This way you don't have to create multiple Data Sources if you like to read data from multiple EndPoints. However not every application support supplying custom SQL to driver so you can only select Table from list returned from driver.

If you're dealing with Microsoft Access and need to import data from an SQL query, it's important to note that Access doesn't allow direct import of SQL queries. Instead, you can create custom objects (Virtual Tables) to handle the import process.

Many applications like MS Access, Informatica Designer wont give you option to specify custom SQL when you import Objects. In such case Virtual Table is very useful. You can create many Virtual Tables on the same Data Source (e.g. If you have 50 URLs with slight variations you can create virtual tables with just URL as Parameter setting.

  1. Go to Custom Objects Tab and Click on Add button and Select Add Table:
    ZappySys Driver - Add Table

  2. Enter the desired Table name and click on OK:
    ZappySys Driver - Add Table Name

  3. And it will open the New Query Window Click on Cancel to close that window and go to Custom Objects Tab.

  4. Select the created table, Select Text Type AS SQL and write the your desired SQL Query and Save it and it will create the custom table in the ZappySys Driver:
    Here is an example SQL query for ZappySys Driver. You can insert Placeholders also. Read more about placeholders here

    SELECT
      "ShipCountry",
      "OrderID",
      "CustomerID",
      "EmployeeID",
      "OrderDate",
      "RequiredDate",
      "ShippedDate",
      "ShipVia",
      "Freight",
      "ShipName",
      "ShipAddress",
      "ShipCity",
      "ShipRegion",
      "ShipPostalCode"
    FROM "Orders"
    Where "ShipCountry"='USA'

    ZappySys Driver - Create Custom Table
  5. That's it now go to Preview Tab and Execute your custom virtual table query. In this example it will extract the orders for the USA Shipping Country only:

    SELECT * FROM "vt__usa_orders_only"
    ZappySys Driver - Execute Custom Virtual Table Query

Read JSON file in Alteryx via SQL view

  1. Open Alteryx Designer.

  2. First, verify your DCM Settings to ensure you can access ODBC drivers. Go to Options > User Settings > Edit User Settings.

    If DCM Mode is set to DCM Only, change it to DCM Optional if you would like to access the legacy Generic ODBC Connection.

    Alteryx DCM User Settings for ODBC access
    After changing this setting, you may need to click Save and restart the connection window for the "Generic ODBC" icon to appear.
  3. Drag an Input Data tool onto your Alteryx canvas.

    Drag Input Data tool onto Alteryx canvas
  4. In the Configuration pane, click Set Up a Connection.

    Set Up a Connection in Alteryx Input Data configuration
  5. Note for DCM Users: If your environment has DCM (Data Connection Manager) enabled, the classic "Generic ODBC" icon may be hidden. To find it, select Data sources on the left and type "ODBC" in the search bar.

  6. Once the ODBC window opens, click Connect Asset and select your OnedriveDSN DSN from the list.

    Connect Asset and select ODBC DSN in Alteryx
    Ensure you have configured a 64-bit System DSN in the Windows ODBC Data Source Administrator before this step.
  7. After selecting your DSN, configure your SQL Query in the Input Data tool configuration:

    Configure SQL Query in Alteryx Input Data tool
  8. To save your data, drag an Output Data tool and connect it to the Input Data tool.

  9. Configure the Output Data tool to write to a CSV file:

    Configure Output Data to CSV in Alteryx
  10. Press Run (Ctrl+R) to execute the workflow. Verify the results in the Results Window at the bottom.

    Run Alteryx workflow and view results

Advanced topics

Creating SQL stored procedures

You can create procedures to encapsulate custom logic and then only pass handful parameters rather than long SQL to execute your API call.

Steps to create Custom Stored Procedure in ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here

  1. Go to Custom Objects Tab and Click on Add button and Select Add Procedure:
    ZappySys Driver - Add Stored Procedure

  2. Enter the desired Procedure name and click on OK:
    ZappySys Driver - Add Stored Procedure Name

  3. Select the created Stored Procedure and write the your desired stored procedure and Save it and it will create the custom stored procedure in the ZappySys Driver. Here is an example stored procedure for ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here

    CREATE PROCEDURE [usp_get_orders]
        @fromdate = '<<yyyy-MM-dd,FUN_TODAY>>'
     AS
        SELECT * FROM Orders where OrderDate >= '<@fromdate>';
    
    ZappySys Driver - Create Custom Stored Procedure
  4. That's it now go to Preview Tab and Execute your Stored Procedure using Exec Command. In this example it will extract the orders from the date 1996-01-01:

    Exec usp_get_orders '1996-01-01';
    ZappySys Driver - Execute Custom Stored Procedure

Conclusion

And there you have it — a complete guide on how to read JSON file (generic) in Alteryx without writing complex code. All of this was powered by OneDrive ODBC Driver, which handled the REST API pagination and authentication for us automatically.

Download the trial now or ping us via chat if you have any questions or are looking for a specific feature (you can also reach out to us by submitting a ticket):

More actions supported by OneDrive Connector

Got another use case in mind? We've documented the exact setups for a variety of essential OneDrive operations directly in Alteryx, so you can skip the trial and error. Find your next step-by-step guide below:

More OneDrive integrations

All
Data Integration
Database
BI & Reporting
Productivity
Programming Languages
Automation & Scripting
ODBC applications