Using the Truelty Python CLI

Truelty’s backend processing uses a Python CLI to orchestrate the Snowflake SQL jobs. Truelty’s Python CLI can be added to a schedular or run manually.

Installing TRUELTY.PY and Setting Environment Variables

  1. Copy the file truelty.py into the directory on the computer where you will run the Truelty Python CLI.
  2. Configure the environment variables on the computer where the CLI will be running. Please add the following environment variables and values:
    1. SF_ACCOUNT = <snowflake full account name>
    2. SF_USER = _truelty_svc
    3. SF_PASSWORD = <password for _truelty_svc>
    4. SF_ROLE = truelty_svc
    5. SF_WAREHOUSE = truelty

Using the Truelty Python CLI

The Truelty Python CLI can be used in several ways to run the backend orchestration. For simplicity, we will present two common options scheduled and manual. See Truelty Python CLI Reference section for a complete list of CLI arguments and descriptions.

Scheduled

  1. Below is an example CLI command for scheduling Truelty. Depending on your scheduler, you will need to enter the file paths for:
    • Python executable
    • truelty.py
Python truelty.py -l truelty TRUELTY.DATA_STORE

Manual Execution

Manually running truelty.py is useful for testing or performing ad-hoc runs.

  1. Open a console or command window on the computer with truelty.py installed
  2. In the console, navigate to the folder where you saved truelty.py.
  3. Below is an example CLI command for running Truelty’s backend process manually.
    1. Replace the **<snowflake account> with your Snowflake full account name.
      1. The full account name can be found in your Snowflake URL between the https:\ and .snowflakecomputing.com
      2. For example: if my Snowflake URL was:
        https://uwb26668.us-east-1.snowflakecomputing.com
        My full account name would be: uwb26668.us-east-1
python truelty.py -u _truelty_svc -p -a <snowflake account> -r truelty_svc -c user_pass -w truelty -l truelty TRUELTY.DATA_STORE

  1. When you run Truelty in manual mode, it will prompt you for the password for the Snowflake user identified in the CLI.
    1. In the example above, we are connecting as the **_truelty_svc user.
    2. When prompted, enter that user’s password.
  2. When running the Truelty CLI in manual mode, you will see in the console/command window the various steps of the backend orchestration.
    1. IMPORTANT: When running in manual mode, do not exit the console/command window until it has finished processing. **
      **