Skip to content

Commit

Permalink
Add script for test load of TAP_SCHEMA in Postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyMcCormick committed Aug 9, 2024
1 parent a0949a3 commit f80639f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/test-load-tap-postgres.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Initialize a variable to track if any command fails
error_occurred=0

# Upload to TAP_SCHEMA database. Clear the tables after each upload to avoid
# conflicts between schemas.
for yaml_file in yml/*.yaml; do
filename=$(basename "yaml_file" .yaml)
echo "Uploading to TAP_SCHEMA from $yaml_file..."
felis --log-level ERROR load-tap "$yaml_file"
# Check if the felis command was successful
if [ $? -ne 0 ]; then
echo "Error: Failed to create SQL from $file"
error_occurred=1
else
echo "Done creating SQL from $yaml_file"
fi
psql -q -c "TRUNCATE TABLE columns, key_columns, keys, schemas, tables;" &> /dev/null
done

# Exit with non-zero status if any command failed
if [ $error_occurred -ne 0 ]; then
echo "Error: Failed to load all schemas into TAP_SCHEMA"
exit 1
fi

0 comments on commit f80639f

Please sign in to comment.