0
# Configuration
1
2
Comprehensive configuration system with settings for database connections, security, caching, feature flags, UI customization, and performance tuning. Supports environment-based configuration, runtime customization, and extensible plugin architecture for enterprise deployments.
3
4
## Capabilities
5
6
### Core Application Settings
7
8
Fundamental application configuration parameters for basic operation and identification.
9
10
```python { .api }
11
VERSION_STRING: str
12
"""
13
Superset version from package.json.
14
Used for display in UI and API responses.
15
"""
16
17
SECRET_KEY: str
18
"""
19
Flask secret key for session management and CSRF protection.
20
Must be set to a secure random value in production.
21
Required for secure cookie signing and session encryption.
22
"""
23
24
SQLALCHEMY_DATABASE_URI: str
25
"""
26
Main database connection string for Superset metadata.
27
Supports PostgreSQL, MySQL, SQLite, and other SQLAlchemy backends.
28
29
Examples:
30
- PostgreSQL: 'postgresql://user:pass@localhost/superset'
31
- MySQL: 'mysql://user:pass@localhost/superset'
32
- SQLite: 'sqlite:///path/to/superset.db'
33
"""
34
35
DATA_DIR: str
36
"""
37
Superset data directory path for file storage.
38
Contains uploaded files, temporary data, and application assets.
39
"""
40
41
DEBUG: bool
42
"""
43
Flask debug mode flag for development.
44
Enables detailed error pages and auto-reload functionality.
45
Should be False in production environments.
46
"""
47
48
FLASK_USE_RELOAD: bool
49
"""
50
Auto-reload server on code changes during development.
51
Works in conjunction with DEBUG mode.
52
"""
53
```
54
55
### Performance and Resource Limits
56
57
Configuration parameters for query performance, result limits, and resource management.
58
59
```python { .api }
60
ROW_LIMIT: int = 50000
61
"""
62
Maximum rows for database queries.
63
Global limit applied to prevent excessive resource consumption.
64
"""
65
66
VIZ_ROW_LIMIT: int = 10000
67
"""
68
Maximum rows for visualization rendering.
69
Separate limit for chart data to ensure UI responsiveness.
70
"""
71
72
FILTER_SELECT_ROW_LIMIT: int = 10000
73
"""
74
Maximum rows for filter dropdown population.
75
Limits the number of distinct values shown in filter controls.
76
"""
77
78
SQL_MAX_ROW: int = 100000
79
"""
80
Maximum rows for asynchronous SQL query results.
81
Applies to SQL Lab queries executed in background.
82
"""
83
84
DISPLAY_MAX_ROW: int = 1000
85
"""
86
Frontend display limit for result tables.
87
Maximum rows shown in UI without pagination.
88
"""
89
90
MAX_TABLE_NAMES: int = 3000
91
"""
92
SQL Lab table dropdown limit.
93
Maximum number of tables shown in schema browser.
94
"""
95
```
96
97
### Web Server Configuration
98
99
Web server settings for network binding, performance, and worker management.
100
101
```python { .api }
102
SUPERSET_WEBSERVER_ADDRESS: str = '0.0.0.0'
103
"""
104
Server bind address for HTTP listener.
105
Use '0.0.0.0' for all interfaces or specific IP for restricted access.
106
"""
107
108
SUPERSET_WEBSERVER_PORT: int = 8088
109
"""
110
HTTP server port number.
111
Default port for Superset web interface.
112
"""
113
114
SUPERSET_WEBSERVER_TIMEOUT: int = 60
115
"""
116
HTTP request timeout in seconds.
117
Maximum time allowed for request processing.
118
"""
119
120
SUPERSET_WORKERS: int = 2
121
"""
122
Number of Gunicorn worker processes.
123
Should be adjusted based on CPU cores and expected load.
124
"""
125
126
SUPERSET_CELERY_WORKERS: int = 32
127
"""
128
Number of Celery worker processes for async tasks.
129
Used for background query processing and task execution.
130
"""
131
```
132
133
### Security Configuration
134
135
Security settings for authentication, CSRF protection, and access control.
136
137
```python { .api }
138
WTF_CSRF_ENABLED: bool = True
139
"""
140
Enable CSRF protection for forms and API endpoints.
141
Provides protection against cross-site request forgery attacks.
142
"""
143
144
WTF_CSRF_EXEMPT_LIST: list
145
"""
146
List of endpoints exempt from CSRF protection.
147
Typically includes API endpoints with token-based authentication.
148
"""
149
150
WTF_CSRF_TIME_LIMIT: int = 604800 # 7 days
151
"""
152
CSRF token expiration time in seconds.
153
Tokens must be refreshed after this period.
154
"""
155
156
AUTH_TYPE: int
157
"""
158
Authentication method configuration.
159
160
Options:
161
- AUTH_DB: Database-based authentication (default)
162
- AUTH_LDAP: LDAP/Active Directory integration
163
- AUTH_OAUTH: OAuth 2.0 provider authentication
164
- AUTH_OID: OpenID Connect authentication
165
- AUTH_REMOTE_USER: Header-based external authentication
166
"""
167
168
CUSTOM_SECURITY_MANAGER: class
169
"""
170
Custom security manager class for specialized access control.
171
Allows override of default permission and authentication logic.
172
"""
173
```
174
175
### Database Configuration
176
177
Database connection settings and SQLAlchemy configuration parameters.
178
179
```python { .api }
180
SQLALCHEMY_TRACK_MODIFICATIONS: bool = False
181
"""
182
SQLAlchemy modification tracking flag.
183
Should be False to avoid memory overhead in production.
184
"""
185
186
SQLALCHEMY_CUSTOM_PASSWORD_STORE: callable
187
"""
188
Custom password storage function for database connections.
189
Enables integration with external secret management systems.
190
"""
191
192
DEFAULT_DB_ID: int
193
"""
194
Default database identifier for SQL Lab.
195
Used when no specific database is selected.
196
"""
197
198
QUERY_SEARCH_LIMIT: int = 1000
199
"""
200
Maximum number of queries returned in search results.
201
Limits query history and search result sizes.
202
"""
203
```
204
205
### Feature Flags
206
207
Toggle switches for enabling or disabling specific application features.
208
209
```python { .api }
210
FEATURE_FLAGS: dict
211
"""
212
Dictionary of feature toggle configurations.
213
Enables selective feature activation for testing and gradual rollouts.
214
215
Example:
216
{
217
'ENABLE_TEMPLATE_PROCESSING': True,
218
'DASHBOARD_NATIVE_FILTERS': True,
219
'VERSIONED_EXPORT': False
220
}
221
"""
222
223
ENABLE_JAVASCRIPT_CONTROLS: bool = False
224
"""
225
Allow JavaScript in visualization controls.
226
Security consideration - enables custom JS in charts.
227
"""
228
229
ENABLE_ACCESS_REQUEST: bool = False
230
"""
231
Enable datasource access request workflow.
232
Allows users to request access to restricted datasources.
233
"""
234
235
PUBLIC_ROLE_LIKE_GAMMA: bool = False
236
"""
237
Grant Gamma-like permissions to public role.
238
Enables anonymous access to dashboards and data.
239
"""
240
241
ENABLE_CORS: bool = False
242
"""
243
Enable Cross-Origin Resource Sharing (CORS).
244
Required for cross-domain API access from external applications.
245
"""
246
247
ENABLE_PROXY_FIX: bool = False
248
"""
249
Enable proxy header processing.
250
Required when running behind reverse proxies or load balancers.
251
"""
252
253
ENABLE_CHUNK_ENCODING: bool = False
254
"""
255
Enable HTTP chunked transfer encoding.
256
Improves streaming performance for large responses.
257
"""
258
259
ENABLE_TIME_ROTATE: bool = False
260
"""
261
Enable log file rotation based on time.
262
Prevents log files from growing indefinitely.
263
"""
264
265
ENABLE_FLASK_COMPRESS: bool = True
266
"""
267
Enable HTTP response compression.
268
Reduces bandwidth usage and improves load times.
269
"""
270
```
271
272
### Cache Configuration
273
274
Caching system settings for performance optimization and result storage.
275
276
```python { .api }
277
CACHE_DEFAULT_TIMEOUT: int = 86400 # 24 hours
278
"""
279
Default cache timeout in seconds.
280
Applied to cached queries and metadata.
281
"""
282
283
CACHE_CONFIG: dict
284
"""
285
Main application cache configuration.
286
287
Example Redis configuration:
288
{
289
'CACHE_TYPE': 'redis',
290
'CACHE_REDIS_URL': 'redis://localhost:6379/0',
291
'CACHE_DEFAULT_TIMEOUT': 3600
292
}
293
294
Example Memcached configuration:
295
{
296
'CACHE_TYPE': 'memcached',
297
'CACHE_MEMCACHED_SERVERS': ['127.0.0.1:11211']
298
}
299
"""
300
301
TABLE_NAMES_CACHE_CONFIG: dict
302
"""
303
Specialized cache configuration for database metadata.
304
Separate cache for table names and schema information.
305
306
Example:
307
{
308
'CACHE_TYPE': 'simple',
309
'CACHE_DEFAULT_TIMEOUT': 300
310
}
311
"""
312
313
RESULTS_BACKEND: dict
314
"""
315
Configuration for asynchronous query result storage.
316
Used for storing large query results from SQL Lab.
317
318
Example Redis backend:
319
{
320
'cache_type': 'redis',
321
'cache_key_prefix': 'superset_results',
322
'cache_redis_url': 'redis://localhost:6379/1'
323
}
324
"""
325
```
326
327
### Internationalization
328
329
Language and localization settings for multi-language support.
330
331
```python { .api }
332
BABEL_DEFAULT_LOCALE: str = 'en'
333
"""
334
Default language locale for the application.
335
Used when user language preference is not available.
336
"""
337
338
BABEL_DEFAULT_FOLDER: str
339
"""
340
Directory path for translation files.
341
Contains .po and .mo files for supported languages.
342
"""
343
344
LANGUAGES: dict
345
"""
346
Supported language configurations.
347
348
Example:
349
{
350
'en': {'flag': 'us', 'name': 'English'},
351
'es': {'flag': 'es', 'name': 'Spanish'},
352
'fr': {'flag': 'fr', 'name': 'French'},
353
'zh': {'flag': 'cn', 'name': 'Chinese'}
354
}
355
"""
356
```
357
358
### File Upload Configuration
359
360
Settings for file upload functionality and CSV data import capabilities.
361
362
```python { .api }
363
UPLOAD_FOLDER: str
364
"""
365
Base directory for file uploads.
366
All uploaded files are stored in subdirectories under this path.
367
"""
368
369
IMG_UPLOAD_FOLDER: str
370
"""
371
Specific directory for image uploads.
372
Used for custom logos, icons, and visualization assets.
373
"""
374
375
IMG_UPLOAD_URL: str
376
"""
377
URL path for serving uploaded images.
378
Maps to the IMG_UPLOAD_FOLDER for web access.
379
"""
380
381
ALLOWED_EXTENSIONS: set = {'csv'}
382
"""
383
Set of allowed file extensions for uploads.
384
Controls which file types can be uploaded to Superset.
385
"""
386
387
CSV_EXPORT: dict
388
"""
389
CSV export format configuration.
390
391
Example:
392
{
393
'encoding': 'utf-8',
394
'delimiter': ',',
395
'line_terminator': '\n',
396
'quote_char': '"'
397
}
398
"""
399
```
400
401
### Email Configuration
402
403
SMTP settings for email notifications and alert delivery.
404
405
```python { .api }
406
EMAIL_NOTIFICATIONS: bool = False
407
"""
408
Enable email notification system.
409
Required for sending dashboard alerts and reports.
410
"""
411
412
SMTP_HOST: str = 'localhost'
413
"""
414
SMTP server hostname or IP address.
415
Mail server for sending outbound notifications.
416
"""
417
418
SMTP_PORT: int = 25
419
"""
420
SMTP server port number.
421
Standard ports: 25 (plain), 587 (STARTTLS), 465 (SSL).
422
"""
423
424
SMTP_USER: str
425
"""
426
SMTP authentication username.
427
Required for authenticated mail servers.
428
"""
429
430
SMTP_PASSWORD: str
431
"""
432
SMTP authentication password.
433
Should be stored securely, preferably as environment variable.
434
"""
435
436
SMTP_MAIL_FROM: str
437
"""
438
Default sender email address.
439
Used as the 'From' address for all outbound emails.
440
"""
441
442
SMTP_STARTTLS: bool = True
443
"""
444
Enable STARTTLS encryption for SMTP connections.
445
Provides security for mail transmission.
446
"""
447
448
SMTP_SSL: bool = False
449
"""
450
Enable SSL/TLS encryption for SMTP connections.
451
Alternative to STARTTLS for secure mail delivery.
452
"""
453
```
454
455
### Druid Configuration
456
457
Apache Druid integration settings for real-time analytics capabilities.
458
459
```python { .api }
460
DRUID_IS_ACTIVE: bool = True
461
"""
462
Enable Druid connector and functionality.
463
Controls availability of Druid datasources in the application.
464
"""
465
466
DRUID_TZ: str = 'UTC'
467
"""
468
Default timezone for Druid queries.
469
Used for time-based operations and aggregations.
470
"""
471
472
DRUID_ANALYSIS_TYPES: list = ['cardinality']
473
"""
474
Enabled Druid analysis types for metadata discovery.
475
Controls which analysis operations are available.
476
"""
477
478
DRUID_DATA_SOURCE_BLACKLIST: list
479
"""
480
List of Druid datasources to exclude from Superset.
481
Prevents access to specified datasources.
482
"""
483
```
484
485
### Advanced Configuration
486
487
Extended configuration options for customization and integration.
488
489
```python { .api }
490
TIME_GRAIN_BLACKLIST: list
491
"""
492
Disabled time grain options across all databases.
493
Removes specific time grouping options from UI.
494
"""
495
496
TIME_GRAIN_ADDONS: dict
497
"""
498
Additional custom time grain definitions.
499
Extends built-in time grouping options.
500
"""
501
502
TIME_GRAIN_ADDON_FUNCTIONS: dict
503
"""
504
Implementation functions for custom time grains.
505
Maps addon names to SQL generation functions.
506
"""
507
508
VIZ_TYPE_BLACKLIST: list
509
"""
510
Disabled visualization types.
511
Removes specific chart types from creation interface.
512
"""
513
514
DEFAULT_MODULE_DS_MAP: dict
515
"""
516
Default datasource module mappings.
517
Associates datasource types with implementation modules.
518
"""
519
520
ADDITIONAL_MODULE_DS_MAP: dict
521
"""
522
Additional custom datasource modules.
523
Enables registration of custom datasource types.
524
"""
525
526
ADDITIONAL_MIDDLEWARE: list
527
"""
528
Custom Flask middleware classes.
529
Allows insertion of custom request/response processing.
530
"""
531
532
BLUEPRINTS: list
533
"""
534
Custom Flask blueprint registrations.
535
Enables addition of custom URL routes and views.
536
"""
537
538
HTTP_HEADERS: dict
539
"""
540
Default HTTP headers for all responses.
541
Commonly used for security headers and CORS configuration.
542
"""
543
544
CORS_OPTIONS: dict
545
"""
546
Cross-Origin Resource Sharing configuration.
547
Detailed CORS policy settings for API access.
548
"""
549
550
MAPBOX_API_KEY: str
551
"""
552
Mapbox API key for map visualizations.
553
Required for Mapbox-based geographic visualizations.
554
"""
555
556
JINJA_CONTEXT_ADDONS: dict
557
"""
558
Additional Jinja template context variables.
559
Extends templating capabilities with custom functions.
560
"""
561
562
ROBOT_PERMISSION_ROLES: list
563
"""
564
Roles managed by API/automation systems.
565
Prevents manual modification of automated role assignments.
566
"""
567
568
FLASK_APP_MUTATOR: callable
569
"""
570
Application customization function.
571
Called during Flask app initialization for custom setup.
572
"""
573
574
DB_CONNECTION_MUTATOR: callable
575
"""
576
Database connection customization function.
577
Modifies database connections before use.
578
"""
579
580
SQL_QUERY_MUTATOR: callable
581
"""
582
SQL query modification function.
583
Allows custom query rewriting and enhancement.
584
"""
585
```
586
587
## Usage Examples
588
589
### Basic Configuration
590
591
```python
592
# config.py
593
SECRET_KEY = 'your-secret-key'
594
SQLALCHEMY_DATABASE_URI = 'postgresql://user:pass@localhost/superset'
595
596
# Development settings
597
DEBUG = True
598
FLASK_USE_RELOAD = True
599
600
# Performance tuning
601
ROW_LIMIT = 25000
602
VIZ_ROW_LIMIT = 5000
603
```
604
605
### Production Configuration
606
607
```python
608
# Production config with Redis caching
609
CACHE_CONFIG = {
610
'CACHE_TYPE': 'redis',
611
'CACHE_REDIS_URL': 'redis://redis-server:6379/0',
612
'CACHE_DEFAULT_TIMEOUT': 3600
613
}
614
615
# Multi-worker setup
616
SUPERSET_WORKERS = 8
617
SUPERSET_CELERY_WORKERS = 16
618
619
# Security hardening
620
WTF_CSRF_ENABLED = True
621
ENABLE_CORS = False
622
```
623
624
### Custom Feature Configuration
625
626
```python
627
# Enable experimental features
628
FEATURE_FLAGS = {
629
'DASHBOARD_NATIVE_FILTERS': True,
630
'ENABLE_TEMPLATE_PROCESSING': True,
631
'VERSIONED_EXPORT': True
632
}
633
634
# Custom visualization blacklist
635
VIZ_TYPE_BLACKLIST = ['iframe', 'markup']
636
```
637
638
### Environment-Based Configuration
639
640
```python
641
import os
642
643
# Use environment variables
644
SECRET_KEY = os.environ.get('SUPERSET_SECRET_KEY')
645
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
646
REDIS_URL = os.environ.get('REDIS_URL', 'redis://localhost:6379/0')
647
648
CACHE_CONFIG = {
649
'CACHE_TYPE': 'redis',
650
'CACHE_REDIS_URL': REDIS_URL
651
}
652
```
653
654
The configuration system provides comprehensive control over all aspects of Superset operation, enabling deployment in diverse environments from development to large-scale enterprise production systems.