DataStore Configuration

---

## Using config Object[​](#config-object "Direct link to Using config Object")

The `config` object is a singleton that manages all settings:

```
from chdb.datastore.config import config

# Read settings
print(config.log_level)
print(config.execution_engine)
print(config.cache_enabled)
print(config.profiling_enabled)

# Modify settings
config.set_log_level(logging.DEBUG)
config.set_execution_engine('chdb')
config.set_cache_enabled(False)
config.enable_profiling()
```

---

## Configuration in Code[​](#in-code "Direct link to Configuration in Code")

### Per-Script Configuration[​](#per-script "Direct link to Per-Script Configuration")

```
from chdb import datastore as pd
from chdb.datastore.config import config

# Configure at script start
config.enable_debug()
config.use_chdb()
config.enable_profiling()

# Your DataStore code
ds = pd.read_csv("data.csv")
result = ds.filter(ds['age'] > 25).groupby('city').agg({'salary': 'mean'})
```

### Context Manager (Future)[​](#context-manager "Direct link to Context Manager (Future)")

```
# Planned feature: temporary configuration
with config.override(execution_engine='pandas'):
    result = ds.process()
# Original settings restored
```

---

## Common Configuration Scenarios[​](#scenarios "Direct link to Common Configuration Scenarios")

### Development/Debugging[​](#dev-config "Direct link to Development/Debugging")

```
from chdb.datastore.config import config

config.enable_debug()        # Verbose logging
config.enable_profiling()    # Performance tracking
config.set_cache_enabled(False)  # Disable caching for fresh results
```

### Production[​](#prod-config "Direct link to Production")

```
from chdb.datastore.config import config
import logging

config.set_log_level(logging.WARNING)  # Minimal logging
config.set_execution_engine('auto')    # Optimal engine selection
config.set_cache_enabled(True)         # Enable caching
config.set_profiling_enabled(False)    # Disable profiling overhead
```

### Maximum Throughput[​](#max-throughput-config "Direct link to Maximum Throughput")

```
from chdb.datastore.config import config

config.use_performance_mode()    # SQL-first, no pandas overhead
config.set_cache_enabled(False)  # Disable cache for streaming
```

### Performance Testing[​](#perf-config "Direct link to Performance Testing")

```
from chdb.datastore.config import config

config.use_chdb()            # Force ClickHouse for benchmarks
config.enable_profiling()    # Track performance
config.set_cache_enabled(False)  # Disable cache for accurate timing
```

### Pandas Compatibility Testing[​](#compat-config "Direct link to Pandas Compatibility Testing")

```
from chdb.datastore.config import config

config.use_pandas()          # Force pandas engine
config.enable_debug()        # See what operations are used
```

---

## Related Documentation[​](#related "Direct link to Related Documentation")

- [Execution Engine](/docs/chdb/configuration/execution-engine) - Engine selection details
- [Performance Mode](/docs/chdb/configuration/performance-mode) - SQL-first mode for maximum throughput
- [Function Config](/docs/chdb/configuration/function-config) - Per-function engine configuration
- [Logging](/docs/chdb/debugging/logging) - Logging configuration
- [Profiling](/docs/chdb/debugging/profiling) - Performance profiling

- [Quick Reference](#quick-reference)- [All Configuration Options](#all-options)- [Configuration Methods](#methods)
      - [Logging Configuration](#logging)- [Cache Configuration](#cache)- [Engine Configuration](#engine)- [Compatibility Mode](#compat-mode)- [Profiling Configuration](#profiling)- [Dtype Correction](#dtype)- [Using config Object](#config-object)- [Configuration in Code](#in-code)
          - [Per-Script Configuration](#per-script)- [Context Manager (Future)](#context-manager)- [Common Configuration Scenarios](#scenarios)
            - [Development/Debugging](#dev-config)- [Production](#prod-config)- [Maximum Throughput](#max-throughput-config)- [Performance Testing](#perf-config)- [Pandas Compatibility Testing](#compat-config)- [Related Documentation](#related)

Was this page helpful?