Extract Application Configuration from SQL
Convert application settings and configuration tables from SQL INSERT statements to CSV format for documentation, comparison, or migration.
Complex Queries
Detailed Explanation
Configuration Data Extraction
Application configuration is often stored in database tables and needs to be exported for documentation, environment comparison, or migration to a different configuration system. SQL to CSV makes this straightforward.
Example SQL
CREATE TABLE app_config (
key VARCHAR(100) PRIMARY KEY,
value TEXT,
data_type VARCHAR(20) DEFAULT 'string',
description VARCHAR(500),
is_secret BOOLEAN DEFAULT FALSE,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO app_config VALUES
('app.name', 'MyApplication', 'string', 'Application display name', FALSE, '2024-01-01 00:00:00'),
('app.version', '2.5.1', 'string', 'Current application version', FALSE, '2024-01-15 10:00:00'),
('db.pool_size', '20', 'integer', 'Database connection pool size', FALSE, '2024-01-10 08:00:00'),
('db.timeout_ms', '5000', 'integer', 'Database query timeout in milliseconds', FALSE, '2024-01-10 08:00:00'),
('cache.ttl_seconds', '3600', 'integer', 'Default cache TTL', FALSE, '2024-01-05 12:00:00'),
('api.rate_limit', '100', 'integer', 'API requests per minute per user', FALSE, '2024-01-12 09:00:00'),
('auth.jwt_secret', '***REDACTED***', 'string', 'JWT signing secret', TRUE, '2024-01-01 00:00:00'),
('auth.session_ttl', '86400', 'integer', 'Session timeout in seconds (24h)', FALSE, '2024-01-01 00:00:00'),
('feature.dark_mode', 'true', 'boolean', 'Enable dark mode feature', FALSE, '2024-01-20 15:00:00'),
('feature.beta_signup', 'false', 'boolean', 'Enable beta signup page', FALSE, '2024-01-18 11:00:00');
Use Cases for Config Export
- Environment comparison: Export configs from staging and production, then diff the CSVs
- Documentation: Convert to CSV then to a Markdown table for wiki documentation
- Migration: Transform SQL config into .env files or YAML using the CSV as an intermediate format
- Audit trail: Track configuration changes over time by comparing periodic CSV exports
Workflow Tip
After exporting to CSV, you can use the CSV to JSON converter to transform the data into JSON format for use in configuration files, or pipe it through the JSON to YAML converter for Kubernetes ConfigMap definitions.
Use Case
Documenting application settings, comparing configurations across environments, or migrating database-stored config to file-based formats like .env or YAML.