Dagweave catalog

Validate a CSV's headers and row count

csv-validatev1.0.1updated 2026-08-182 versions

Validate that a CSV document has a header row containing a required set of columns and at least a minimum number of data rows; fails the step otherwise.

Install v1.0.1

Installs the template into your Argo namespace. The URL is pinned to this version.

kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/csv-validate/1.0.1/template.yaml

Or with the Argo CLI:

argo template create -n argo https://catalog.dagweave.com/api/v1/items/csv-validate/1.0.1/template.yaml

Facts

Category
Data
Tags
data python
Entrypoint
validate
Template SHA-256
1a4bd25c39c105f6c1b4d8c46dce4a750eb8e234fbb9d6da2357222e7f93fb67
Source
csv-validate at catalog commit 67458f7
API
item document, latest template.yaml

Images and provenance

Every image is pinned by digest, so a rebuilt tag can never change what this version runs.

RepositoryTagDigest
python3.15-slimsha256:94d3426f1def7db4a106a232ac121bfd975393e5dfd40a619b955fae45fe7913

Parameters

NameDescriptionDefault
csv-content required The CSV document to validate, as a string (header row required). none
min-rows Minimum number of data rows the CSV must contain (0 = no minimum). 0
required-columns Comma-separated list of column names that must be present in the header.
Example id,email,created_at
empty

WorkflowTemplate

Download template.yaml

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: csv-validate
  labels:
    dagweave.io/catalog-item: csv-validate
  annotations:
    # The catalog semver this manifest was authored at. The dagweave app records
    # (catalog-item-id, semver) -> content-hash -> base-vN when it mints the tenant
    # cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.
    dagweave.io/catalog-version: "1.0.1"
    dagweave.io/catalog-category: "Data"
spec:
  entrypoint: validate
  templates:
    - name: validate
      inputs:
        parameters:
          # The CSV document to validate, as a string (header row required).
          - name: csv-content
          # Comma-separated list of column names that must be present in the header.
          - name: required-columns
            default: ""
          # Minimum number of data rows the CSV must contain (0 = no minimum).
          - name: min-rows
            default: "0"
      container:
        # Pinned by digest per the catalog convention: an image rebuild can never
        # silently change the behaviour of an already-released item version.
        # python:3.15-slim
        image: python@sha256:94d3426f1def7db4a106a232ac121bfd975393e5dfd40a619b955fae45fe7913
        # The script is a static program; all user values arrive via env vars
        # (read with os.environ), never interpolated into code or a shell.
        command: [python, -c]
        args:
          - |
            import csv, io, os, sys
            content = os.environ["CSV_CONTENT"]
            required = [c.strip() for c in os.environ.get("REQUIRED_COLUMNS", "").split(",") if c.strip()]
            min_rows = int(os.environ.get("MIN_ROWS", "0") or "0")
            reader = csv.reader(io.StringIO(content))
            try:
                header = [h.strip() for h in next(reader)]
            except StopIteration:
                print("FAIL: CSV is empty (no header row)", file=sys.stderr)
                sys.exit(1)
            missing = [c for c in required if c not in header]
            if missing:
                print("FAIL: missing required columns: " + ", ".join(missing), file=sys.stderr)
                sys.exit(1)
            rows = sum(1 for _ in reader)
            if rows < min_rows:
                print("FAIL: expected at least %d data rows, found %d" % (min_rows, rows), file=sys.stderr)
                sys.exit(1)
            print("OK: %d columns, %d data rows; all %d required columns present" % (len(header), rows, len(required)))
        env:
          - name: CSV_CONTENT
            value: "{{inputs.parameters.csv-content}}"
          - name: REQUIRED_COLUMNS
            value: "{{inputs.parameters.required-columns}}"
          - name: MIN_ROWS
            value: "{{inputs.parameters.min-rows}}"

Version history

Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.

  1. 1.0.1 latest 2026-08-18

    Repin python:3.13-slim on the current digest. Same tag, CPython 3.13.14 to 3.13.15, and Entrypoint, Cmd, User and WorkingDir are identical on both. The repin clears nothing: util-linux CVE-2026-53615 is on the new bytes too. What it buys is a record that holds, because an OS baseline covers a pin only while that pin is its tag's head, and this one had fallen behind. pip also moves 26.1.2 to 26.2.1, which ships an SBOM of its vendored tree, so trivy now reports the msgpack and setuptools the old pin already vendored without declaring; both are recorded in hack/image-cve-exceptions.txt. This item runs python -c over the stdlib and never invokes pip.

    kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/csv-validate/1.0.1/template.yaml
    argo template create -n argo https://catalog.dagweave.com/api/v1/items/csv-validate/1.0.1/template.yaml

    version document, template.yaml

  2. 1.0.0 2026-07-16

    Initial release.

    This release is documented, but its manifest is not vendored here, so it has no install command. Version document

Run it once

After installing, from the command line.

argo submit -n argo --from workflowtemplate/csv-validate \
  -p csv-content=...

Workflow that references it

A Workflow with the required parameters filled from the examples.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: csv-validate-
spec:
  workflowTemplateRef:
    name: csv-validate
  arguments:
    parameters:
      - name: csv-content
        value: "..."

As a step of a larger workflow

steps:
  - - name: csv-validate
      templateRef:
        name: csv-validate
        template: validate