This documentation is available to agents as Markdown at https://docs.synthesized.io/tdk/latest/user_guide/020_guides/generating_data/csv_generation.md. For the complete documentation index, see llms.txt.

CSV Files

Synthesized supports transforming CSV files using either the CLI or web interface.

Storage Options

  • Local Files: Use CLI only

  • S3 Storage: Use CLI or web interface

  • Uploaded in UI: web interface only

File Structure Requirements

CSV files must be organized in a specific directory structure. Each directory represents a table, and all files within a directory should have the same schema.

Organize your CSV files in directories by table:

my-bucket/my-input-dir/     # For S3 storage
├── orders/
│   ├── orders1.csv
│   └── orders2.csv
├── products/
│   └── products1.csv
└── users/
    └── users1.csv

After a run, the output directory has the same structure as the input, with one data.csv file per table:

my-bucket/my-output-dir/
├── orders/
│   └── data.csv
├── products/
│   └── data.csv
└── users/
    └── data.csv

File Format

Synthesized expects CSV files with:

  • First row as header

  • Comma-separated values

  • Quote character: "

  • Empty strings treated as nulls

Configuration

CSV transformations use the same configuration as database transformations. Schema name must be public because CSV data is internally processed as tables in a temporary database structure where all tables are created in the public schema namespace:

default_config:
  mode: MASKING
safety_mode: STRICT

tables:
   - table_name_with_schema: "public.orders"
     target_ratio: 0.98

   - table_name_with_schema: "public.products"
     mode: GENERATION
     target_row_number: 100

   - table_name_with_schema: "public.users"
     mode: GENERATION
     target_ratio: 5

Each run rewrites the output files, so with table_truncation_mode: TRUNCATE or the default DO_NOT_TRUNCATE the result is the same. With IGNORE, the new rows are appended to the existing files. schema_creation_mode doesn’t apply to CSV output.

Usage

  • Synthesized Web Interface

  • Synthesized CLI

The web interface accepts CSV files stored in S3 compatible storage or uploaded files. It provides visual workflow management, monitoring, and scheduling capabilities.

csv datasources
Step 1: Connect your CSV’s

Set up your S3 connection with endpoint, bucket, and credentials.

The S3 URL uses the format s3://<endpoint>/<bucket>/<directory>/ for both input and output.
s3 source

OR upload the file directly

csv upload
Step 2: Create CSV Workflow

Create a new workflow and select your S3 data source.

CSV workflow
Step 3: Run

Configure and execute your workflow.

csv output

Execute your workflow and track progress.

CSV workflow run
Step 4: Review Results

View results and access transformed files in S3.

CSVOutput

Use the command line interface for both local files and S3 storage. Provides direct control and automation capabilities.

Local Files

CSV transformations with local files require the working directory option to be enabled:

TDK_WORKINGDIRECTORY_ENABLED=true TDK_WORKINGDIRECTORY_PATH=/my-working-directory \
    tdk -c config.yaml --input-url file:///my-input-dir/ --output-url file:///my-output-dir/
S3 Files

For S3 storage, configure the S3 client with environment variables and provide credentials:

export TDK_WORKINGDIRECTORY_ENABLED=true
export TDK_WORKINGDIRECTORY_PATH=wd
export TDK_S3_REGION=eu-west-1
export AWS_ACCESS_KEY_ID="<access key id>"
read -s -r AWS_SECRET_ACCESS_KEY  # type or paste the key, then press Enter
export AWS_SECRET_ACCESS_KEY

tdk -c config.yaml \
    --input-url=s3://s3.amazonaws.com/my-bucket/my-input-dir/ \
    --output-url=s3://s3.amazonaws.com/my-bucket/my-output-dir/ \
    --input-username="$AWS_ACCESS_KEY_ID" \
    --input-password="$AWS_SECRET_ACCESS_KEY" \
    --output-username="$AWS_ACCESS_KEY_ID" \
    --output-password="$AWS_SECRET_ACCESS_KEY"
S3 URLs use the format s3://<endpoint>/<bucket>/<directory>/. The implementation works with AWS S3, MinIO, and other S3-compatible services.
Keep secret keys out of the shell history: anything typed on the command line, including export AWS_SECRET_ACCESS_KEY=…​, is saved there. Prefer a secret manager and pass the secrets with --input-password-secret and --output-password-secret (see Secret Managers). Otherwise, read the key with read -s -r AWS_SECRET_ACCESS_KEY as shown above, which neither echoes it nor saves it in the history.