Notion Business Intelligence CLI
Command-line tools for managing and monitoring your Notion Business Intelligence Platform.Overview
The CLI provides direct access to data refresh operations, system health monitoring, and business intelligence export capabilities. These tools are designed for operational management, automated workflows, and administrative tasks.Installation
The CLI is included with your Django application. Ensure your environment is properly configured:Configuration
Set required environment variables:Command Reference
Data Refresh Commands
Comprehensive Refresh
Targeted Data Refresh
Analytics-Only Refresh
Cache Management
System Monitoring
Health Checks
Performance Monitoring
Data Export
Business Intelligence Reports
Raw Data Export
Usage Patterns
Daily Operations
Morning Data SyncDevelopment Workflow
Testing ChangesProduction Deployment
Post-Deployment VerificationCommand Options
Global Options
--force: Force refresh even if data appears recent--dry-run: Show what would be done without executing--clear-cache: Clear relevant caches after operation--preload-lookups: Load lookup tables for better performance--generate-analytics: Generate fresh analytics after data refresh
Output Formats
Most commands provide structured output:- Success operations show green checkmarks
- Warnings appear in yellow
- Errors display in red
- Progress indicators for long operations
Troubleshooting
Common Issues
Authentication ErrorsError Diagnostics
Database ConnectivityAutomation
Cron Jobs
Daily Data RefreshCI/CD Integration
Deployment PipelinePerformance Considerations
Optimization Strategies
Lookup PreloadingResource Usage
- Memory: Lookup preloading increases memory usage but improves performance
- Network: Full refreshes make multiple API calls to Notion
- Time: Complete refresh typically takes 2-5 minutes depending on data volume
Security
Best Practices
- Store API tokens in environment variables, not code
- Use restricted Notion integration tokens when possible
- Monitor API usage through health checks
- Regularly rotate API tokens
Access Control
Integration Examples
Shell Scripts
Python Scripts
Development
Adding Custom Commands
Create new management commands invault/api/trace/management/commands/:
Extending the CLI
Add new shortcuts todj.sh:
Support
For issues with CLI commands:- Check command syntax with
./dj.sh(shows usage) - Run health check:
./dj.sh health - Try dry run mode:
./dj.sh rf all --dry-run - Check Django logs for detailed error messages
- Verify environment configuration and API tokens
Version Compatibility
- Django 3.2+
- Python 3.8+
- Notion API version 2022-06-28
- Redis (recommended for caching)