TundraDB shell now supports two powerful new features for development and testing:
- Script Execution: Execute TundraQL script files and then continue with interactive shell
- Unique Database: Create timestamped database folders for isolated testing
Execute a script file containing TundraQL statements, then keep the shell open for interactive use.
./build/tundra_shell --script test_scripts/simple_test.sqlFeatures:
- Executes all statements in the file sequentially
- Shows progress and execution status for each statement
- Handles comments (lines starting with
--) - Continues to interactive shell after script completion
- Reports execution statistics (statements executed/failed)
Append a timestamp to the database path to create a unique database folder.
./build/tundra_shell --unique-db
# Creates database at: ./test-db_20241128_143052_123Benefits:
- Avoid conflicts with existing databases
- Enable parallel testing
- Create isolated test environments
- Automatic cleanup through unique naming
The most powerful combination is using both features together:
./build/tundra_shell --script test_scripts/join_test.sql --unique-dbThis will:
- Create a unique timestamped database
- Execute the script against the new database
- Keep the shell open for additional interactive commands
- Leave you with a clean, isolated test environment
- Parser Integration: Uses the same ANTLR parser as interactive mode
- Error Handling: Continues execution even if individual statements fail
- Progress Reporting: Shows each statement being executed
- Statistics: Reports total statements executed and failed
- Timestamp Format:
YYYYMMDD_HHMMSS_mmm(includes milliseconds) - Path Construction: Appends timestamp to provided or default database path
- Example:
./test-dbbecomes./test-db_20241128_143052_123
- Modular Design:
executeStatement()function used by both script and interactive modes - File Processing:
executeScriptFile()handles file reading and statement parsing - Consistent Error Handling: Same error reporting across all execution modes
# Test new features without affecting main database
./build/tundra_shell --script test_scripts/new_feature_test.sql --unique-db# Run test suite with isolated databases
for script in test_scripts/*.sql; do
./build/tundra_shell --script "$script" --unique-db
done# Set up test data then work interactively
./build/tundra_shell --script test_scripts/setup_data.sql --unique-db
# Continue with interactive commands...
tundra> MATCH (u:User) WHERE u.age > 25;# Prepare demo environment
./build/tundra_shell --script demo_setup.sql --db-path ./demo-dbAll test scripts are organized in the test_scripts/ folder:
simple_test.sql- Basic functionality demonstrationdelete_test.sql- DELETE operations testingjoin_test.sql- JOIN types testing (INNER, LEFT, RIGHT, FULL)where_test.sql- WHERE clause operators testingREADME.md- Comprehensive documentation
- Individual statement failures don't stop script execution
- Clear error messages with line numbers
- Final summary shows success/failure counts
- Clear error messages for missing files
- Graceful fallback to interactive mode
- Helpful usage suggestions
- Batch Mode:
--batchflag to exit after script execution - Output Redirection: Save query results to files
- Variable Substitution: Support for parameterized scripts
- Script Includes: Support for including other script files
- Conditional Execution: IF/ELSE logic in scripts
- Transaction Support: Rollback on script failure
# Test DELETE functionality in isolation
./build/tundra_shell --script test_scripts/delete_test.sql --unique-db# Set up development environment
./build/tundra_shell --script test_scripts/dev_setup.sql --db-path ./dev-db
# Test specific feature
./build/tundra_shell --script test_scripts/feature_test.sql --unique-db
# Run comprehensive test suite
./build/tundra_shell --script test_scripts/full_test.sql --unique-dbThis feature significantly improves the development and testing experience by providing automated script execution with database isolation capabilities.