
프로덕션 데이터베이스의 일부를 추출하여 로컬에서 버그를 재현하세요. dbslice를 레코드에 지정하면 외래 키를 따라가며 완전하고 가져올 수 있는 하위 집합을 제공합니다.
로컬 개발 및 디버깅을 위해 최소한의 참조 무결성을 유지하는 데이터베이스 하위 집합을 추출합니다.
전체 프로덕션 데이터베이스를 로컬 머신으로 복사하는 것은 불가능합니다. 하지만 버그 재현을 위해서는 종종 버그를 유발한 정확한 데이터가 필요합니다. dbslice는 외래 키 관계를 따라가며 참조 무결성을 보장하여 필요한 레코드만 추출함으로써 이 문제를 해결합니다.
# Install globally
uv tool install dbslice # or: pip install dbslice
# Extract an order and all related records
dbslice extract postgres://localhost/myapp --seed "orders.id=12345" > subset.sql
# Import into local database
psql -d localdb < subset.sql
| 데이터베이스 | 상태 |
|---|---|
| PostgreSQL | 완전 지원 |
| MySQL | 계획됨 (아직 구현되지 않음) |
| SQLite | 계획됨 (아직 구현되지 않음) |
# Install with uv (recommended)
uv add dbslice
# Try without installing
uvx dbslice --help
# Or with pip
pip install dbslice
# Extract by primary key
dbslice extract postgres://user:pass@host:5432/db --seed "orders.id=12345"
# Extract with WHERE clause
dbslice extract postgres://localhost/db --seed "orders:status='failed' AND created_at > '2024-01-01'"
# Multiple seeds
dbslice extract postgres://localhost/db \
--seed "orders.id=100" \
--seed "orders.id=101"
# Limit depth (default: 3)
dbslice extract postgres://... --seed "orders.id=1" --depth 2
# Direction: up (parents only), down (children only), both (default)
dbslice extract postgres://... --seed "orders.id=1" --direction up
# Auto-anonymize detected sensitive fields
dbslice extract postgres://... --seed "users.id=1" --anonymize
# Redact additional fields
dbslice extract postgres://... --seed "users.id=1" --anonymize --redact "audit_logs.ip_address"
로컬 브라우저 UI에서 시각적으로 컬럼을 매핑하고, 규정 준수 프로필을 적용하며, 바로 사용 가능한 설정을 생성할 수 있습니다.
dbslice map postgres://localhost/myapp
# Custom port
dbslice map postgres://localhost/myapp --port 8888
# Also works with uvx (no install needed)
uvx dbslice map postgres://localhost/myapp
| 컬럼을 익명화 규칙에 매핑 | 설정 생성 및 내보내기 |
![]() | ![]() |
일회성 세션 토큰과 함께 127.0.0.1:9473에서 실행되며, 데이터가 로컬 머신을 벗어나지 않습니다. 한 번의 클릭으로 GDPR, HIPAA 또는 PCI-DSS 프로필을 적용하고, 마스킹될 내용을 검토한 후 YAML을 다운로드할 수 있습니다.
# HIPAA Safe Harbor — auto-masks all 18 identifier types
dbslice extract postgres://... --seed "patients.id=1" --compliance hipaa --compliance-strict
# Multiple profiles + audit manifest
dbslice extract postgres://... --seed "users.id=1" --compliance gdpr --compliance pci-dss -f subset.sql
# Produces subset.sql + subset.manifest.json
# SQL (default)
dbslice extract postgres://... --seed "orders.id=1" --output sql
# JSON fixtures
dbslice extract postgres://... --seed "orders.id=1" --output json --out-file fixtures/
# CSV
dbslice extract postgres://... --seed "orders.id=1" --output csv --out-file data/
데이터베이스 스키마에 정의되지 않은 관계(Django GenericForeignKey, 암시적 관계)를 처리합니다:
# dbslice.yaml
database:
url: postgres://localhost:5432/myapp
virtual_foreign_keys:
- source_table: notifications
source_columns: [object_id]
target_table: orders
description: "Generic FK to orders via ContentType"
- source_table: audit_log
source_columns: [user_id]
target_table: users
description: "Implicit FK without DB constraint"
dbslice extract --config dbslice.yaml --seed "users.id=1"
dbslice inspect postgres://localhost/myapp
# Generate config from database
dbslice init postgres://localhost/myapp --out-file dbslice.yaml
# Use config
dbslice extract --config dbslice.yaml --seed "orders.id=12345"
dbslice는 가볍고 제로 구성의 Python 옵션으로, 1분 이내에 설치하고 추출할 수 있습니다.
git clone https://github.com/nabroleonx/dbslice.git
cd dbslice
uv sync --dev
uv run pytest
MIT
| 기능 | dbslice | Jailer | Greenmask | slice-db |
|---|
| 언어 | Python | Java | Go | Ruby |
| 구성 | 제로 구성 | 모델 파일 필요 | 구성 필요 | 수동 YAML |
| 설정 시간 | 몇 초 | 몇 시간 | 중간 | 중간 |
| 익명화 | 내장 (Faker) | 플러그인 기반 | 고급 변환기 | 없음 |
| 규정 준수 프로필 | GDPR, HIPAA, PCI-DSS | 없음 | 없음 | 없음 |
| 컬럼 매핑 UI | 내장 (로컬) | 없음 | 없음 | 없음 |
| PII 값 스캐닝 | 2단계 (마스크 전/후) | 없음 | 없음 | 없음 |
| 하위 집합 추출 | FK 탐색 | FK 탐색 | 제한적 | FK 탐색 |
| 출력 형식 | SQL, JSON, CSV | SQL, XML, CSV | SQL | SQL만 |
| 순환 처리 | 자동 | 수동 설정 | 해당 없음 | 수동 |
| 스트리밍 | 내장 | 설정 가능 | 내장 | 없음 |
| 유지 관리 | 활발 | 활발 | 활발 | 중단됨 |