About Collectors
Pre-requisites
Collector Server Minimum Requirements
Hightouch Requirements
-
Access to Hightouch
-
Upon generating an API Key it will have access to the REST APIs in general https://hightouch.com/docs/developer-tools/api-guide
Limitations
Currently K only support the below sources to an API destination.
|
SOURCE |
METHOD |
DESTINATION |
|---|---|---|
|
Snowflake |
SQL |
API |
|
Postgres |
SQL |
API |
Step 1: Create the Source in K
-
Go to Settings, Select Sources and click Add Source
-
Select Hightouch as the Source Type
-
Select "Load from File system" option
-
Give the source a Name - e.g. Hightouch Production
-
Add the Host name for the Hightouch Server
-
Click Finish Setup
Step 2: Getting Access to the Source Landing Directory
Step 3: Install the Collector
It is recommended to use a python environment such as pyenv or pipenv if you are not intending to install this package at the system level.
You can download the Latest Core Library and whl via Platform Settings → Sources → Download Collectors
Run the following command to install the collector
pip install kada_collectors_extractors_<version>-none-any.whl
You will also need to install the common library kada_collectors_lib for this collector to function properly.
pip install kada_collectors_lib-<version>-none-any.whl
Step 4: Configure the Collector
The collector requires a set of parameters to connect to and extract metadata from Hightouch.
|
FIELD |
FIELD TYPE |
DESCRIPTION |
EXAMPLE |
|---|---|---|---|
|
api_token |
string |
The API token for Hightouch |
sdflsl23lksdnfsdfknx |
|
mapping |
JSON |
Mapping file of data source names against the onboarded host and database name in K |
{"myDSN": {"host": "myhost", "database": "mydatabase"}} |
|
timeout |
integer |
Timeout in seconds |
20 |
|
output_path |
string |
Absolute path to the output location |
"/tmp/output" |
|
mask |
boolean |
To enable masking or not |
true |
|
compress |
boolean |
To gzip the output or not |
true |
kada_hightouch_extractor_config.json
{
"api_token": "",
"output_path": "/tmp/output",
"mask": true,
"timeout": 20,
"mapping": {
"myDSN": {
"host": "myhost",
"database": "mydatabase"
}
},
"compress": true
}
Step 6: Run the Collector
This is the wrapper script: kada_hightouch_extractor.py
import os
import argparse
from kada_collectors.extractors.utils import load_config, get_hwm, publish_hwm, get_generic_logger
from kada_collectors.extractors.hightouch import Extractor
get_generic_logger('root')
_type = 'hightouch'
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, 'kada_{}_extractor_config.json'.format(_type))
parser = argparse.ArgumentParser(description='KADA Hightouch Extractor.')
parser.add_argument('--config', '-c', dest='config', default=filename)
parser.add_argument('--name', '-n', dest='name', default=_type)
args = parser.parse_args()
start_hwm, end_hwm = get_hwm(args.name)
ext = Extractor(**load_config(args.config))
ext.test_connection()
ext.run(**{"start_hwm": start_hwm, "end_hwm": end_hwm})
publish_hwm(args.name, end_hwm)
Advance options:
If you wish to maintain your own high water mark files elsewhere you can use the above section's script as a guide on how to call the extractor. The configuration file is simply the keyword arguments in JSON format. Refer to this document for more information https://kadaai.atlassian.net/wiki/spaces/KKB/pages/3333849163/Collector+Integration+General+Notes#Storing-HWM-in-another-location
If you are handling external arguments of the runner yourself, you'll need to consider additional items for the run method. Refer to this document for more information https://kadaai.atlassian.net/wiki/spaces/KKB/pages/3333849163/Collector+Integration+General+Notes#The-run-method
Step 7: Check the Collector Outputs
K Extracts
A set of files (eg metadata, databaselog, linkages, events etc) will be generated. These files will appear in the output_path directory you set in the configuration details
High Water Mark File
A high water mark file is created in the same directory as the execution called hightouch_hwm.txt and produce files according to the configuration JSON. This file is only produced if you call the publish_hwm method.
If you want prefer file managed hwm, you can edit the location of the hwm by following these instructions https://kadaai.atlassian.net/wiki/spaces/KKB/pages/3333849163/Collector+Integration+General+Notes#Storing-High-Water-Marks-(HWM)
Step 8: Push the Extracts to K
Once the files have been validated, you can push the files to the K landing directory.
You can use Azure Storage Explorer if you want to initially do this manually. You can push the files using python as well (see Airflow example below)