Mode
Integrating your Mode in Catalog
Requirements
To get things started with Mode in Catalog, you will need:
Get
admin
credentials on yourMode Analytics
instance.Generate an
API token
by following these instructions
Catalog managed
Please:
Send the API key info to us using Safenote via Slack/Email
For your first sync, it will take up to 48h and we will let you know when it is complete ✅
If you are not comfortable giving us access to your credentials, please continue to Client managed 👇
Client managed
Doing a one shot extract
For your trial, you can simply give us a one shot view of your BI tools
To get things working quickly, here's a Google Colab to run swiftly our package.
Running the Extraction package
Install the PyPi package
pip install castor-extractor[mode]
For further details: link
Running the PyPi package
Once the package has been installed, you should be able to run the following command in your terminal:
castor-extract-mode [arguments]
The script will run and display logs as following:
INFO - Authentication succeeded.
INFO - Starting extraction for DATASOURCE...
INFO - Calling https://modeanalytics.com/api/...
INFO - 1 rows extracted
INFO - Wrote output file: /tmp/catalog/1649080890-datasource.json
INFO - Starting extraction for COLLECTION...
...
INFO - Wrote output file: /tmp/catalog/1649080890-member.json
INFO - Wrote output file: /tmp/catalog/1649080890-summary.json
Credentials
-H
,--host
: the name/IP of the host where your instance of Mode Analytics in installed.
-w
,--workspace
: The name of your workspace. More information here-t
,--token
: TheToken
value from the API token created in Mode.-s
,--secret
: ThePassword
value from the API token created in Mode.
Other arguments
-o
,--output
: target folder to store the extracted files
Use ENV variables
If you don't want to specify arguments every time, you can set the following ENV in your .bashrc
:
CASTOR_MODE_ANALYTICS_HOST
CASTOR_MODE_ANALYTICS_WORKSPACE
CASTOR_MODE_ANALYTICS_TOKEN
CASTOR_MODE_ANALYTICS_SECRET
CASTOR_OUTPUT_DIRECTORY
Then the script can be executed without any arguments:
castor-extract-mode
It can also be executed with partial arguments (the script looks in your ENV
as a fallback):
castor-extract-mode --output /tmp/catalog
Scheduling and Push to Catalog
When moving out of trial, you'll want to refresh your Mode content in Catalog. Here is how to do it:
The Catalog team will provide you with
Catalog Identifier
(an id for us to match your Mode files with your Catalog instance)Catalog Token
An API Token
You can then use the castor-upload
command:
castor-upload [arguments]
Arguments
-k
,--token
: Token provided by Catalog-s
,--source_id
: account id provided by Catalog-t
,--file_type
: source type to upload. Currently supported are {DBT
|VIZ
|WAREHOUSE
}
Target files
To specify the target files, provide one of the following:
-f
,--file_path
: to push a single file
or
-d
,--directory_path
: to push several files at once (*)
(*) The tool will upload all files included in the given directory.
Make sure it contains only the extracted files before pushing.
Then you'll have to schedule the script run and the push to Catalog, use your preferred scheduler to create this job
You're done!
Last updated
Was this helpful?