-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script for test load of TAP_SCHEMA in Postgres
- Loading branch information
1 parent
a0949a3
commit f80639f
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |