> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DataStore 구성

> DataStore 실행 엔진, 로깅, 캐싱, 프로파일링 및 Dtype 보정을 구성합니다

DataStore는 실행 엔진 선택, 호환성 모드, 로깅, 캐싱, 프로파일링, Dtype 보정을 위한 다양한 구성 옵션을 제공합니다.

<div id="quick-reference">
  ## 빠른 참고
</div>

```python theme={null}
from chdb.datastore.config import config

# 빠른 설정 프리셋
config.enable_debug()           # 상세 로깅 활성화
config.use_chdb()               # ClickHouse 엔진 강제 사용
config.use_pandas()             # pandas 엔진 강제 사용
config.use_auto()               # 엔진 자동 선택 (기본값)
config.use_performance_mode()   # SQL 우선, 최대 처리량
config.use_pandas_compat()      # 완전한 pandas 호환성 (기본값)
config.enable_profiling()       # 성능 프로파일링 활성화
```

<div id="all-options">
  ## 모든 구성 옵션
</div>

| 범주        | 옵션                       | 값                             | 기본값      | 설명                       |
| --------- | ------------------------ | ----------------------------- | -------- | ------------------------ |
| **로깅**    | `log_level`              | DEBUG/INFO/WARNING/ERROR      | WARNING  | 로그 상세 수준                 |
|           | `log_format`             | "simple", "verbose"           | "simple" | 로그 메시지 포맷                |
| **캐시**    | `cache_enabled`          | True/False                    | True     | 결과 캐싱 활성화                |
|           | `cache_ttl`              | float (seconds)               | 0.0      | 캐시 TTL                   |
| **엔진**    | `execution_engine`       | "auto", "chdb", "pandas"      | "auto"   | 실행 엔진                    |
|           | `cross_datastore_engine` | "auto", "chdb", "pandas"      | "auto"   | DataStore 간 작업           |
| **호환성**   | `compat_mode`            | "pandas", "performance"       | "pandas" | Pandas 호환성 또는 SQL 우선 처리량 |
| **프로파일링** | `profiling_enabled`      | True/False                    | False    | 프로파일링 활성화                |
| **Dtype** | `correction_level`       | NONE/CRITICAL/HIGH/MEDIUM/ALL | HIGH     | Dtype 보정 수준              |

***

<div id="methods">
  ## 구성 방법
</div>

<div id="logging">
  ### 로깅 구성
</div>

```python theme={null}
from chdb.datastore.config import config
import logging

# 로그 레벨 설정
config.set_log_level(logging.DEBUG)
config.set_log_level(logging.INFO)
config.set_log_level(logging.WARNING)  # 기본값
config.set_log_level(logging.ERROR)

# 로그 포맷 설정
config.set_log_format("simple")   # 기본값
config.set_log_format("verbose")  # 더 자세한 정보 표시

# 디버그 모드 빠르게 활성화
config.enable_debug()  # DEBUG 레벨과 verbose 포맷으로 설정
```

자세한 내용은 [로깅](/ko/products/chdb/debugging/logging) 문서를 참조하십시오.

<div id="cache">
  ### 캐시 구성
</div>

```python theme={null}
# 캐싱 활성화/비활성화
config.set_cache_enabled(True)   # 기본값
config.set_cache_enabled(False)  # 캐싱 비활성화

# 캐시 TTL(time-to-live) 설정
config.set_cache_ttl(60.0)  # 60초 후 캐시 만료
config.set_cache_ttl(0.0)   # 만료 없음 (기본값)

# 현재 설정 확인
print(config.cache_enabled)
print(config.cache_ttl)
```

<div id="engine">
  ### 엔진 구성
</div>

```python theme={null}
# 실행 엔진 설정
config.set_execution_engine('auto')    # 자동 선택 (기본값)
config.set_execution_engine('chdb')    # ClickHouse 강제 사용
config.set_execution_engine('pandas')  # pandas 강제 사용

# 빠른 프리셋
config.use_auto()     # 자동 선택
config.use_chdb()     # ClickHouse 강제 사용
config.use_pandas()   # pandas 강제 사용

# Cross-DataStore 엔진 (서로 다른 DataStore 간 작업에 사용)
config.set_cross_datastore_engine('auto')
config.set_cross_datastore_engine('chdb')
config.set_cross_datastore_engine('pandas')

# 현재 엔진 확인
print(config.execution_engine)
```

자세한 내용은 [실행 엔진](/ko/products/chdb/configuration/execution-engine)을 참고하십시오.

<div id="compat-mode">
  ### 호환성 모드
</div>

```python theme={null}
# 성능 모드: SQL 우선, pandas 호환성 오버헤드 없음
config.use_performance_mode()
# 또는: config.set_compat_mode('performance')

# Pandas 호환성 모드 (기본값)
config.use_pandas_compat()
# 또는: config.set_compat_mode('pandas')

# 현재 모드 확인
print(config.compat_mode)  # 'pandas' 또는 'performance'
```

자세한 내용은 [성능 모드](/ko/products/chdb/configuration/performance-mode)를 참조하십시오.

<div id="profiling">
  ### 프로파일링 구성
</div>

```python theme={null}
# 프로파일링 활성화
config.enable_profiling()
config.set_profiling_enabled(True)

# 프로파일링 비활성화
config.set_profiling_enabled(False)

# 프로파일링 활성화 여부 확인
print(config.profiling_enabled)
```

자세한 내용은 [프로파일링](/ko/products/chdb/debugging/profiling)을 참조하십시오.

<div id="dtype">
  ### Dtype 보정
</div>

```python theme={null}
from chdb.datastore.dtype_correction.config import CorrectionLevel

# 보정 수준 설정
config.set_correction_level(CorrectionLevel.NONE)      # 보정 없음
config.set_correction_level(CorrectionLevel.CRITICAL)  # 중요 타입만
config.set_correction_level(CorrectionLevel.HIGH)      # 기본값
config.set_correction_level(CorrectionLevel.MEDIUM)    # 추가 보정
config.set_correction_level(CorrectionLevel.ALL)       # 모든 보정
```

***

<div id="config-object">
  ## `config` 객체 사용하기
</div>

`config` 객체는 모든 설정을 관리하는 단일 인스턴스입니다:

```python theme={null}
from chdb.datastore.config import config

# 설정 읽기
print(config.log_level)
print(config.execution_engine)
print(config.cache_enabled)
print(config.profiling_enabled)

# 설정 수정
config.set_log_level(logging.DEBUG)
config.set_execution_engine('chdb')
config.set_cache_enabled(False)
config.enable_profiling()
```

***

<div id="in-code">
  ## 코드 내 구성
</div>

<div id="per-script">
  ### 스크립트별 구성
</div>

```python theme={null}
from chdb import datastore as pd
from chdb.datastore.config import config

# 스크립트 시작 시 구성
config.enable_debug()
config.use_chdb()
config.enable_profiling()

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

<div id="context-manager">
  ### Context Manager(향후 지원)
</div>

```python theme={null}
# 계획된 기능: 임시 구성
with config.override(execution_engine='pandas'):
    result = ds.process()
# 원래 설정 복원됨
```

***

<div id="scenarios">
  ## 일반적으로 사용되는 구성 시나리오
</div>

<div id="dev-config">
  ### 개발/디버깅
</div>

```python theme={null}
from chdb.datastore.config import config

config.enable_debug()        # 상세 로깅
config.enable_profiling()    # 성능 추적
config.set_cache_enabled(False)  # 최신 결과를 위해 캐싱 비활성화
```

<div id="prod-config">
  ### 프로덕션 환경
</div>

```python theme={null}
from chdb.datastore.config import config
import logging

config.set_log_level(logging.WARNING)  # 최소 로깅
config.set_execution_engine('auto')    # 최적 엔진 선택
config.set_cache_enabled(True)         # 캐싱 활성화
config.set_profiling_enabled(False)    # 프로파일링 오버헤드 비활성화
```

<div id="max-throughput-config">
  ### 최대 처리량
</div>

```python theme={null}
from chdb.datastore.config import config

config.use_performance_mode()    # SQL 우선, pandas 오버헤드 없음
config.set_cache_enabled(False)  # 스트리밍용 캐시 비활성화
```

<div id="perf-config">
  ### 성능 테스트
</div>

```python theme={null}
from chdb.datastore.config import config

config.use_chdb()            # 벤치마크를 위해 ClickHouse 강제 사용
config.enable_profiling()    # 성능 추적
config.set_cache_enabled(False)  # 정확한 시간 측정을 위해 캐시 비활성화
```

<div id="compat-config">
  ### Pandas 호환성 테스트
</div>

```python theme={null}
from chdb.datastore.config import config

config.use_pandas()          # pandas 엔진 강제 사용
config.enable_debug()        # 사용되는 작업 확인
```

***

<div id="related">
  ## 관련 문서
</div>

* [실행 엔진](/ko/products/chdb/configuration/execution-engine) - 엔진 선택에 대한 자세한 정보
* [성능 모드](/ko/products/chdb/configuration/performance-mode) - 최대 처리량을 위한 SQL 우선 모드
* [함수 구성](/ko/products/chdb/configuration/function-config) - 함수별 엔진 구성
* [로깅](/ko/products/chdb/debugging/logging) - 로깅 구성
* [프로파일링](/ko/products/chdb/debugging/profiling) - 성능 프로파일링
