name: demo-sql
inputs:
  samplesheet: File
  data_dir: Directory
steps:
  - id: filter
    uses: filter-samples
    with:
      samplesheet: inputs.samplesheet
      data_dir: inputs.data_dir
    publish:
      filtered_sheet: File(filtered_samplesheet.csv)

  - id: count
    uses: count-lines
    with:
      samplesheet: step.filter.outputs.filtered_sheet
      data_dir: inputs.data_dir
    publish:
      counted_sheet: File(line_counts.csv)
    store:
      counts_sql:
        kind: sql
        destination: SQL()
        source: counted_sheet
        table_name: pipeline_counts_{run_id}
        participant_column: participant_id

  - id: sum
    uses: sum-total
    with:
      samplesheet: step.count.outputs.counted_sheet
      data_dir: inputs.data_dir
    publish:
      result_summary: File(results.txt)
