Is there a way to translate bash script to Azure with dapclient

Pete5484
Community Participant

So, not super familiar with Azure but we've managed to set up a pipeline (but getting occasional fails) and debating finisihing incremental approach. I do ultimately want to get this into a postgres db.azure.png

At the moment I get far more reliable data using a simple script on localhost dev! Have noted 1.0.0.0 is now out; I've got one script for syncdb and an another for initidb.

#!/bin/bash
#chmod +x filename.sh
#./filename.sh
#requirements/dependencies: python >=3.10; pip; instructure-dap-client >=0.3.18 https://pypi.org/project/instructure-dap-client
#use venv or conga environment
#check slashes on windows machines
#30-Jan-2024


echo "Namespace: canvas - getting dap list of tables"
output=$(dap list)

echo "$output" | while IFS= read -r line; do
    echo "Canvas Namespace - getting:" "$line" || echo "it failed"
    dap initdb --connection-string postgresql://<username>:<password>@localhost:5432/cd2_dev --namespace canvas --table "$line"
done


echo "Namespace: canvas_logs - getting dap list of tables"
output=$(dap list --namespace canvas_logs)

echo "$output" | while IFS= read -r line; do
    echo "Canvas_logs Namespace - getting:" "$line" || echo "it failed"
    dap initdb --connection-string postgresql://<username>:<password>@localhost:5432/cd2_dev --namespace canvas_logs --table "$line"
done

#to import constraints
#export PGPASSWORD=<password>
#psql -h localhost -U username -d CD2_dev -q -f myContraintsInsertFile
#or use $ psql simulator 
# simulator=% \i Desktop/myFile.sql

Had to swiitch to Is it possible to just run this at CLI in Azure?  I did have to DISABLE TRIGGER ALL; because processing the tables alphabetically would trigger violations on foreign_keys.

Labels (4)
0 Likes