# SDV (Synthetic Data Vault)

> Learn patterns from real tables and generate realistic synthetic data in Python

- Category: Data & Labeling / Synthetic Data
- Language: Python
- Licence: Business Source License
- Repository: https://github.com/sdv-dev/SDV
- Website: https://docs.sdv.dev/sdv
- Canonical page: https://ai-tldr.dev/tools/sdv-synthetic-data-vault/

## In short

SDV (Synthetic Data Vault) is a Python library for creating tabular synthetic data. It uses machine learning models to learn the patterns in your real data, then generates new tables that follow those same statistical patterns without copying the original rows. It sits in the Synthetic Data category of the Data & Labeling tools and is open-source, written in Python and licensed Business Source License.

## Overview

SDV (Synthetic Data Vault) is a Python library for creating tabular synthetic data. It uses machine learning models to learn the patterns in your real data, then generates new tables that follow those same statistical patterns without copying the original rows.

It is meant for data scientists and engineers who need realistic test data, want to share datasets without exposing sensitive values, or need extra training data. SDV handles single tables, multiple connected tables, and sequential (time-based) data.

Within the synthetic data category, SDV covers the full workflow: it describes your data with metadata, fits a synthesizer, samples new rows, and then evaluates how close the synthetic data is to the real data with a quality report.

## What it does

- Multiple models, from the statistical GaussianCopula to the deep-learning CTGAN
- Generates data for single tables, multiple connected tables, or sequential tables
- Quality reports and column plots to compare synthetic data against the real data
- Built-in anonymization for sensitive columns such as emails, addresses, and credit card numbers
- Preserves keys and relationships, including unique primary keys and primary/foreign key links
- Logical constraints to encode business rules during data processing

## Getting started

Install SDV with pip, load a demo dataset, fit a synthesizer, and sample synthetic rows.

1. Install SDV

   Install from PyPI (a virtual environment is recommended). Conda is also supported.

```bash
pip install sdv
```

2. Load a demo dataset

   Download a built-in single-table demo. This returns both the data and its metadata.

```python
from sdv.datasets.demo import download_demo

real_data, metadata = download_demo(modality='single_table', dataset_name='fake_hotel_guests')
```

3. Fit a synthesizer and sample data

   Create a synthesizer, fit it on the real data, then sample new synthetic rows.

```python
from sdv.single_table import GaussianCopulaSynthesizer

synthesizer = GaussianCopulaSynthesizer(metadata)
synthesizer.fit(data=real_data)

synthetic_data = synthesizer.sample(num_rows=500)
```

4. Evaluate the synthetic data

   Generate a quality report that scores how closely the synthetic data matches the real data.

```python
from sdv.evaluation.single_table import evaluate_quality

quality_report = evaluate_quality(real_data, synthetic_data, metadata)
```

## When to use it

- Generate safe test and demo data that mirrors production without exposing real customer values
- Share or publish a dataset by replacing sensitive columns with anonymized synthetic ones
- Create extra training data when a real dataset is small or imbalanced
- Reproduce multi-table or time-series data while keeping keys and relationships intact
