This is a guide for installing Source Enablement Packs for WhereScape RED 8.6.1.x
Prerequisites
- Python 3.8 or higher
- Download Python installer from {+}https://www.python.org/downloads/+
- Select "Add Python 3.8 to PATH" from the installation Window
- PIP Manager
- From Command Prompt (Run As Administrator) run the command:
python -m pip install --upgrade pip
- From Command Prompt (Run As Administrator) run the command:
- Google Drive
- Enable Google API and setup from {+}https://console.cloud.google.com/home/dashboard+ NOTE: Refer to section Google Drive API Connection Steps below for more details.
- Download authentication file credentials.json
- Install Google API packages:Google API Packages
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib pip install google-api-python-client pip install --upgrade google-api-python-client oauth2client
NOTE: Use 64-bit powershell terminal
Source Enablement Pack Setup Scripts
Scripts entirely drive the Enablement Pack Install process. The table below outlines these scripts, their purpose, and if "Run as Administrator" is required.
# | Enablement Pack Setup Scripts | Script Purpose | Run as Admin | Intended Application |
1 | install_Source_Enablement_Pack.ps1 | Install Python scripts and UI Config Files for browsing files from Amazon S3, Azure Data Lake Gen2, Google Drive | Yes | New and Existing installations |
Powershell script above provides some help at the command line, this can be output by passing the -help
parameter to the script.
Source Enablement Pack Installation
- Run Windows Powershell as Administrator Install Source Connectivity Packs
<Script1 Location > Powershell -ExecutionPolicy Bypass -File .\install_Source_Enablement_Pack.ps1
- If prompted enter the source enablement pack as 'Google' Note: Skip the installation step if the target build with source packs is installed.
Google Drive Connection Setup
- Login to RED
- Check in Host Script Browse_Google_Drive in objects list.
- Check UI Configurations in Menu, Tools → UI Configurations → Maintain UI Configurations
- Create a new connection in RED
- Select properties as shown in below screenshot
- Property Section Google Drive Settings
- Drive Folder: Source file location on Google Drive.Path till single Child folder supported, for example: 'rootFolder
subFolder' are considered. Path for shared files are supported. The token used to read the directory name in the script is $WSL_SRCCFG_googleDriveFolderPath$
- Drive Folder: Source file location on Google Drive.Path till single Child folder supported, for example: 'rootFolder
- Property Section Google Drive Auth File Path
- Authentication Files Path: File location where credentials.json file is stored. This path will also be used to create and store token.json file for authentication.
The token used to read Authentication Files Path in the scripts is $WSL_SRCCFG_googleDriveCredentialsFilePath$
- Authentication Files Path: File location where credentials.json file is stored. This path will also be used to create and store token.json file for authentication.
- Property Section Google Drive File Filter Options
- Field Headings/Labels : Indicates whether the first line of source file contains a heading/label for each field, which is not regarded as data so it should not be loaded. The token used to reader field header boolean value in the script is $WSL_SRCCFG_googleDriveFirstLineHeader$
- File Filter Name: Indicates source file name.Provide Google Drive filename pattern. The file list filters with file extensions,file name patterns
- *.*
- *.<File Extension>
- <File Name>.<File Extension>
- <File Name Start>*
- The token used to read File Filter Name in the scripts is $WSL_SRCCFG_googlDriveFileFilterName$
- Field Delimiter: This is a character that separates the fields within each record of the source file. The field delimiter identifies end of each field.For Example, comma ( , ),pipe( | ). The token used to reader field delimiter in the script is $WSL_SRCCFG_googleDriveFieldDelimiter$
- Field Enclosure Delimiter: This is a character that delimits BOTH start and end of field value i.e. encapsulates value. A double quote is a common enclosure delimiter. The token used to reader field enclosure delimiter in the script is $WSL_SRCCFG_googleDriveFieldEnclosureDelimiter$
- Record Delimiter: This is to identify how each line/record in source file is ended/terminated/delineated. Default is '\n' . The token used to read the record delimiter value in the script is $WSL_SRCCFG_googleDriveRecordDelimiter$
- Data Limit (in KB) for Data Profiling: Kilobytes (KB's) to scan for Data Profiling. Data profiling is used to get the column names and data types from the source file.By default 100 KB will be scanned. The token used to read the record delimiter value in the script is $WSL_SRCCFG_googleDriveDataLimit$
- Files with extension .dat are read as a single column because Google Drive reads .dat files as application/octet-stream file type
- Folders present in Google Drive must have unique names. Example: "REDFolder" and "REDFolder1" similar folder names should be avoided
- Files which are deleted from 'Google Drive Folders' are still browsable. To avoid such files, delete them from 'Bin\Trash' as well.
- Sometimes, it might take 2-5 minutes for files or directories that were recently added/uploaded to 'Google Drive' to be browsed.
Google Drive API Setup Steps - Optional
These steps are for Google API connection setup.If the API is already set and credentials.json is ready then these steps are not required.
- Visit this URL: {+}https://console.cloud.google.com/home/dashboard+ and select Select a project → New Project
- Enter a project name and click Create
- Go to APIs & Services and then to Library
- Search for Drive API and click Enable
- Click Credentials on the left and then click + CREATE CREDENTIALS and select OAuth client ID
- Click CONFIGURE CONSENT SCREEN and select User Type as External
- In 'App Information' add App name, User support email (current email), and Developer Contact info (current email)
- In 'Scope Section' click ADD OR REMOVE SCOPES
- Search for 'Drive' and select "{+}https://www.googleapis.com/auth/drive+" scope
- Click the checkbox next to the selected scope and click update
- Click SAVE AND CONTINUE
- In "Test Users Section", click on + ADD USERS
- Add Users who can connect with these APIs. Note: Users who are listed here can only log in and browse files. A maximum of 100 users can be added. This section can be edited anytime.
- Click Save and Continue
- Go back to 'Credentials' and click + CREATE CREDENTIALS and select OAuth client ID
- Select 'Application type' as "Desktop app" and enter a name, for example: 'Gdrive_RED'
- In the 'Credentials Section' under "OAuth 2.0 Client IDs" verify the auth app which was just created and press the download button which is at the end of that row.
- Save this file with name "credentials" ONLY
- Save the 'credentials.json' file in a folder.
- Login to RED and create a Google drive connection as mentioned in the above section Google Drive Connection Setup
- Right-click and browse the connection.
- It will be directed to default browser, select 'Google Id' which you want to connect with drive.
- On "Google hasn't verified this app" screen, click Continue
- Click Allow to grant necessary permission.
- A success message will be displayed on both, browser and RED. Close browser windows and browse the connection again in RED.
Troubleshooting and Tips
Run As Administrator
Press the Windows Key on your keyboard and start typing cmd.exe, when the cmd.exe icon shows up in the search list right click it to bring up the context menu, select Run As Administrator
Now you have an admin prompt navigate to to the folder where you have unpacked your WhereScape Source Enablement Pack using the cd
command:C:\Windows\system32> cd <full path to the unpacked folder>
Run Powershell (.ps1) scripts from the administrator prompt by typing the Powershell run script command, for example:C:\temp\EnablementPack>Powershell -ExecutionPolicy Bypass -File .\install_Source_Enablement_Pack.ps1
In the event you can not bypass the Powershell execution policy due to group policies you can instead try -ExecutionPolicy RemoteSigned
which should allow unsigned local scripts.
Windows Powershell Script Execution
On some systems, Windows Powershell script execution is disabled by default. There are several workarounds for this which can be found by searching the term "Powershell Execution Policy".
Here is the most common workaround that WhereScape suggests, which does not permanently change the execution rights:
Start a Windows CMD prompt as Administrator, change the directory to your script directory, and run the WhereScape Powershell scripts with this command:
cmd:>Powershell -ExecutionPolicy Bypass -File .\<script_file_name.ps1>
Restarting failed scripts
Some of the setup scripts will track each step and output the step number when there is a failure. To restart from the failed step (or to skip the step) provide the parameter -startAtStep <step number>
to the script.
Example: Powershell -ExecutionPolicy Bypass -File .\<script_file_name.ps1> -startAtStep 123
If a valid RED installation can not be found
If you have Red 8.6.1.x or higher installed but the script (install_Source_Enablement_Pack.ps1) fails to find it on your system then you are most likely running the PowerShell (x86) version which does not show installed 64-bit apps by default. Please open a 64-bit version of PowerShell instead and re-run the script.