Skip to content

Extract BI Server with CS Tools. #294

Extract BI Server with CS Tools.

Extract BI Server with CS Tools. #294

name:
Extract BI Server with CS Tools.
on:
workflow_dispatch:
schedule:
# Runs every day at 5:15 AM UTC
- cron: "15 5 * * *"
jobs:
extract_data_from_thoughtspot:
# Configure Environment Variables for CS Tools configuration
env:
CS_TOOLS_THOUGHTSPOT__URL: ${{ secrets.THOUGHTSPOT_URL }}
CS_TOOLS_THOUGHTSPOT__USERNAME: ${{ secrets.THOUGHTSPOT_USERNAME }}
CS_TOOLS_THOUGHTSPOT__SECRET_KEY: ${{ secrets.THOUGHTSPOT_SECRET_KEY }}
# CS_TOOLS_TEMP_DIR: ...
DECLARATIVE_SYNCER_SYNTAX: account_name=${{ secrets.SNOWFLAKE_ACCOUNT }}&username=${{ secrets.SNOWFLAKE_USERNAME }}&secret=${{ secrets.SNOWFLAKE_PASSWORD }}&warehouse=${{ secrets.SNOWFLAKE_WAREHOUSE }}&role=${{ secrets.SNOWFLAKE_ROLE }}&database=${{ secrets.SNOWFLAKE_DATABASE }}&schema=${{ secrets.SNOWFLAKE_SCHEMA }}&authentication=basic
runs-on: ubuntu-latest
steps:
- name: Get 7 days ago
run: echo "days_ago_7=$(date -d "-7 days" +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Get 1 days ago
run: echo "days_ago_1=$(date -d "-1 days" +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Check out the repository main branch
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install a specific version of CS Tools
run: python -m pip install -e .[cli]
- name: Install Snowflake Syncer requirements
run: python -m pip install snowflake-sqlalchemy>=1.6.1 cryptography
# --config ENV: tells CS Tools to pull the information from environment variables.
- name: Grab N-7 to N-1 days of BI Server Data
run: "cs_tools tools searchable bi-server --from-date $days_ago_7 --to-date $days_ago_1 --syncer 'snowflake://${{ env.DECLARATIVE_SYNCER_SYNTAX }}&load_strategy=UPSERT' --config ENV:"