
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ditto-dql-cli
Advanced tools
A sandbox CLI for running DQL queries against Ditto databases with benchmarking and performance tracking
A comprehensive sandbox environment for testing and benchmarking DQL queries against a Ditto database with a preloaded movie dataset, featuring performance benchmarking and baseline tracking capabilities.
Tested with Ditto SDK versions 4.8 to 4.12
This application is designed for local DQL query execution and does not enable sync intentionally.
To reset the database stop the application and delete the
./dittodirectory from the root.
npm install -g ditto-dql-cli
dql
npx ditto-dql-cli
dql # Run with installed version
dql 4.10.0 # Run with Ditto SDK 4.10.0
dql 4.11.5 # Run with Ditto SDK 4.11.5
dql --help # Show usage information
git clone https://github.com/skylerjokiel/ditto-dql-cli.git
cd ditto-dql-cli
npm install
npm run dev
The terminal will automatically import the movie dataset on first run. If a benchmark_baselines.ndjson file exists in the root directory, it will also import baseline data.
.help - Show help message with all available commands.list - Show all available scenarios with index numbers.run <name|index> - Run a predefined scenario by name or index number (e.g., .run count_all or .run 1).all - Run all scenarios in sequence with comprehensive summary.bench <query> - Benchmark a custom query (20 runs with statistics).benchmarks - List all available predefined benchmarks.benchmark <name|index> [runs] - Run a specific predefined benchmark with optional run count (default: 5).benchmark_all [runs] - Run all predefined benchmarks with optional run count.benchmark_baseline [runs] - Create baselines for all benchmarks (default: 50 runs).benchmark_baseline <name> [runs] - Create baseline for specific benchmark.benchmark_show - Display saved baseline comparison table.system - Display comprehensive system information including Ditto version, hardware details, and database statistics.export <query> - Export query results to exports/export_<timestamp>.ndjson file.generate_movies <count> - Generate and insert random movies into the collection.log_dump - Export current log buffer to logs/manual-logs_<timestamp>.ndjson file.log_debug - Show log buffer debug information (buffer size, latest logs).exit - Exit the terminal-- Count all movies
SELECT count(*) FROM movies
-- Find movies by year
SELECT * FROM movies WHERE _id.year = '2001'
-- Search by title
SELECT * FROM movies WHERE CONTAINS(_id.title,'Star')
Each movie in the database has the following structure:
{
"_id": {
"id": "573a1390f29313caabcd4135",
"title": "Blacksmith Scene",
"year": "1893",
"type": "movie"
},
"plot": "Three men hammer on an anvil...",
"genres": ["Short"],
"runtime": 1,
"cast": ["Charles Kayser", "John Ott"],
"fullplot": "A stationary camera looks at...",
"countries": ["USA"],
"released": "1893-05-09T00:00:00.000Z",
"directors": ["William K.L. Dickson"],
"rated": "UNRATED",
"awards": {
"wins": 1,
"nominations": 0,
"text": "1 win."
},
"imdb": {
"rating": 6.2,
"votes": 1189,
"id": 5
},
"tomatoes": {
"viewer": {
"rating": 3,
"numReviews": 184,
"meter": 32
}
}
}
This application functions as a comprehensive test harness for DQL queries with built-in validation:
Scenarios can include automated validation for:
Scenarios support both simple strings and validation objects:
{
"my_scenario": [
"DROP INDEX IF EXISTS my_index ON movies",
{
"query": "SELECT * FROM movies WHERE rated = 'PG'",
"expectedCount": 1234,
"expectedIndex": "full_scan",
"maxExecutionTime": 500
},
"CREATE INDEX my_index ON movies (rated)",
{
"query": "SELECT * FROM movies WHERE rated = 'PG'",
"expectedCount": 1234,
"expectedIndex": "my_index",
"maxExecutionTime": 50
}
]
}
Run .list to see all scenarios with their index numbers. You can run scenarios either by name or index:
.run index_basic or .run 1 - Basic index performance validation.run index_string_contains or .run 2 - Text search with CONTAINS.run validation_test or .run 3 - Result count validation examplesUse .all to run all scenarios and get a comprehensive test report.
Use the .bench command to benchmark any custom query:
.bench SELECT * FROM movies WHERE rated = 'APPROVED'
This will run the query 20 times and provide detailed statistics:
The application includes predefined benchmark suites for common query patterns:
.benchmarks # List all available benchmarks
.benchmark count # Run the "count" benchmark
.benchmark 1 # Run benchmark by index
.benchmark count 10 # Run benchmark with custom run count
.benchmark_all # Run all predefined benchmarks
.benchmark_all 10 # Run all benchmarks with 10 runs each
Track performance changes across Ditto versions using the baseline system:
.benchmark_baseline # Create baseline for all benchmarks (50 runs)
.benchmark_baseline 100 # Create baseline for all with custom run count
.benchmark_baseline count # Create baseline for specific benchmark
.benchmark_baseline count 100 # Create baseline for specific benchmark with custom runs
.benchmark_show # Display saved baseline comparison table
When running benchmarks, the system automatically compares results against:
Both .benchmark_all and .benchmark_show display comprehensive summary tables showing performance across versions with color-coded differences:
Baseline Data Import:
If you have a benchmark_baselines.ndjson file in the root directory, the application will automatically import it on startup when the baseline collection is empty. This is useful for:
Adding Custom Benchmarks:
Edit benchmarks.json to add new benchmark queries:
{
"my_benchmark": {
"query": "SELECT * FROM movies WHERE runtime > 150 LIMIT 100",
"preQueries": ["CREATE INDEX IF NOT EXISTS runtime_idx ON movies (runtime)"],
"postQueries": ["DROP INDEX IF EXISTS runtime_idx ON movies"]
}
}
Perfect for comparing indexed vs non-indexed query performance and maintaining consistent performance testing!
All benchmark results in this repository were collected on the following system:
System Information:
Platform: darwin arm64
OS Release: 24.6.0
CPU Information:
Model: Apple M1 Max
Cores: 10
Important Notes:
.system command shows your current hardware specifications for referenceWhen sharing benchmark results or comparing performance:
.system command)The .system command provides comprehensive information about your environment:
.system
This displays:
Use this information to:
Export query results to NDJSON format for backup, analysis, or migration:
.export SELECT * FROM movies # Export all movies
.export SELECT * FROM movies WHERE rated = 'PG' # Export filtered movies
.export SELECT * FROM benchmark_baselines # Export baseline data
.export SELECT _id.title, runtime FROM movies LIMIT 100 # Export specific fields
The export command:
exports/ directory if it doesn't existexport_2024-10-04T09-30-15.ndjsonexports/ directory (ignored by git)NDJSON format is ideal for:
jq or custom scriptsCreate and insert randomly generated movies for testing at scale:
.generate_movies 1000 # Generate 1,000 random movies
.generate_movies 50000 # Generate 50,000 random movies
.generate_movies 1000000 # Generate 1 million movies (with confirmation prompt)
The generate_movies command:
Generated movies include:
Perfect for:
To add a new scenario, edit scenarios.json and add your queries with optional validation:
{
"my_scenario": [
"DROP INDEX IF EXISTS my_index ON movies",
{
"query": "SELECT * FROM movies WHERE runtime > 120",
"expectedCount": 8500,
"expectedIndex": "full_scan",
"maxExecutionTime": 800
},
"CREATE INDEX my_index ON movies (runtime)",
{
"query": "SELECT * FROM movies WHERE runtime > 120",
"expectedCount": 8500,
"expectedIndex": "my_index",
"maxExecutionTime": 100
}
]
}
Stop and restart the app then run it with .run my_scenario
dql <version> command.benchmark_baseline <name> [runs].benchmark_show command to view saved baselines without running benchmarks.export <query>exports/ directory (git-ignored)logs/error-logs_<timestamp>.ndjson.log_dump command for troubleshooting.log_debug to check buffer statusMIT
FAQs
A sandbox CLI for running DQL queries against Ditto databases with benchmarking and performance tracking
We found that ditto-dql-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.