bigeye-se-commons 0.0.1
SE Demo Commons
Requires Python: >=3.8

# Sales Engineering Commons

## Config and Credentails
[AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)

~/.aws/credentials
```shell
[default]
aws_access_key_id=<aws_access_key_id>
aws_secret_access_key=<aws_secret_access_key> 
```

~/.aws/config
```shell
[default]
region=us-west-2
output=json
```

~/.bashrc or ~/.zshrc
```shell
export AWS_SHARED_CREDENTIALS_FILE=~/.aws/credentials
export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain bigeye --domain-owner 021451147547 --query authorizationToken --output text`
```

~/.keys/snowflake_bigeye (Same json format for AWS Secret Manager)
```json
{
    "account_identifier": "toropartner.snowflakecomputing.com",
    "user": "<<user>>",
    "password": "<<password>>"
}
```

~/.bigeye/conf/green_homes.conf
```json
{
    "base_url": "https://app.bigeye.com",
    "user": "<<user>>",
    "password": "<<password>>"
}
```

## Poetry
```shell
pip install --user poetry
```

## AWS CodeArtifact pypi
```shell
pip config set global.index-url https://aws:$CODEARTIFACT_AUTH_TOKEN@bigeye-021451147547.d.codeartifact.us-west-2.amazonaws.com/pypi/pypi-store/simple/
```

## Setting up Terraform
[Terraform Install Docs](https://learn.hashicorp.com/tutorials/terraform/install-cli)

### MacOS

```shell
# Install dependencies and upgrades
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
brew update
brew upgrade hashicorp/tap/terraform

# Verify the install
terraform -help

# Install Autocomplete
terraform -install-autocomplete
```

### Ubuntu

```shell
# Install dependencies and upgrades
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install terraform

# Verify the install
terraform -help

# Install Autocomplete
terraform -install-autocomplete
```

## SE Tools CLI
### Overview
SE Tools CLI contains tools sales engineers can use for common customer asks.  Examples include: 
* deploy all autometrics
* delete and redeploy all metrics

```shell
bash se_tools.sh --help
```

## Demo
### Overview
The demo library contains data-as-code modules, functions, and definitions that can be used to create
consistent, repeatable, synthetic data sets.  Demo environments are persisted as code using Terraform.  All 
demos must have a class that implements DemoBuilder and, therefore, will have init_demo and run_delta 
functionality.  The demo cli can be used to run inits locally and Airflow can be used to schedule deltas.

```shell
bash demo.sh --help
```

## Airflow
### Overview
[Astronomer](astronomer.io) provides a local runtime for Airflow DAGs.  This runtime
is build from the Dockerfile in the astro folder.  A startup bash script has been 
added, ***astro_dev***, to facilitate the needed code copy into the astro environment.

Test environment is currently compatible with Python <= 3.8 and Airflow 2.0.2.

### Running test environment

```shell
bash astro_dev --help
```