Skip to content

Commit

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

# Check if FELIS_ENGINE_URL is set
if [ -z "$FELIS_ENGINE_URL" ]; then
echo "Error: FELIS_ENGINE_URL is not set. Please set the environment variable and try again."
exit 1
fi

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

for yaml_file in yml/*.yaml; do
filename=$(basename "$yaml_file")
echo "Uploading to TAP_SCHEMA from $yaml_file..."
felis --log-level ERROR load-tap --engine-url ${FELIS_ENGINE_URL}/TAP_SCHEMA "$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
mysql -DTAP_SCHEMA -e "
DELETE FROM \`columns\`;
DELETE FROM \`key_columns\`;
DELETE FROM \`keys\`;
DELETE FROM \`schemas\`;
DELETE FROM \`tables\`;
"
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 0ec0380

Please sign in to comment.