Skip to content

Commit

Permalink
Merge pull request #9 from bigeyedata/andy/workspace_update
Browse files Browse the repository at this point in the history
updated CLI cmds
  • Loading branch information
at-rodriguez authored May 3, 2024
2 parents 8370e49 + c0fbe3f commit bb80e0b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/deploy_schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ jobs:
python -m pip install --upgrade pip
python -m pip install bigeye-cli
mkdir .bigeye && echo "$BIGEYE_CONFIG" >> .bigeye/config.ini && echo "$BIGEYE_CREDENTIALS" >> .bigeye/credentials.ini
echo "$BIGEYE_CONFIG" >> config.ini
echo "$BIGEYE_CREDENTIALS" >> credentials.ini
for file in ${CHANGED_FILES}; do
echo "Creating schedule from ${file}"
schedule_info=$(<"${file}")
sname=$(echo "${schedule_info}" | yq '.schedule_name')
schedule_cron=$(echo "${schedule_info}" | yq '.cron')
bigeye workspace create-named-schedule --name "${sname}" --cron "${schedule_cron}"
bigeye workspace create-named-schedule --bigeye_conf credentials.ini --config_file config.ini --name "${sname}" --cron "${schedule_cron}"
done

6 changes: 4 additions & 2 deletions .github/workflows/deploy_virtual_tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install bigeye-cli
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq
mkdir .bigeye && echo "$BIGEYE_CONFIG" >> .bigeye/config.ini && echo "$BIGEYE_CREDENTIALS" >> .bigeye/credentials.ini
echo "$BIGEYE_CONFIG" >> config.ini
echo "$BIGEYE_CREDENTIALS" >> credentials.ini
for file in ${CHANGED_FILES}; do
echo "Virtual table upsert for ${file}"
vtn=$(cat ${file} | yq '.table_name')
sn=$(cat ${file} | yq '.source_name')
sql=$(cat ${file} | yq '.sql')
bigeye catalog upsert-virtual-table -vtn "${vtn}" -sn "${sn}" --sql "${sql}"
bigeye catalog upsert-virtual-table --bigeye_conf credentials.ini --config_file config.ini -vtn "${vtn}" -sn "${sn}" --sql "${sql}"
done

2 changes: 1 addition & 1 deletion schedules/everyday_at_midnight.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
schedule_name: Everyday at 00:00 CDT
schedule_name: Daily at 00:00 CDT
cron: 0 5 * * *
2 changes: 1 addition & 1 deletion virtual_tables/snowflake/snowflake_spend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ sql: |
((A.client_hour_execution_time/B.hour_execution_time)*C.credits_used) *3.00 AS approximate_dollar_spend
FROM client_hour_execution_cte A
JOIN hour_execution_cte B
ON A.start_time_hour = B.start_time_hour and B.warehouse_name = A.warehouse_name and a.database_name=b.database_name and a.user_name=b.user_name and a.role_name=b.role_name
ON A.start_time_hour = B.start_time_hour AND B.warehouse_name = A.warehouse_name AND a.database_name=b.database_name AND a.user_name=b.user_name AND a.role_name=b.role_name
JOIN snowflake.account_usage.warehouse_metering_history C
ON C.warehouse_name = A.warehouse_name AND C.start_time = A.start_time_hour
ORDER BY A.start_day desc, total_daily_execution_time_minutes desc

0 comments on commit bb80e0b

Please sign in to comment.