Edit page in Livemark
(2024-11-07 15:17)

Extract

With Frtictionless extract command you can extract data from a file or a dataset.

Normal Mode

By default, it outputs metadata visually formatted:

frictionless extract tables/*.csv
─────────────────────────────────── Dataset ────────────────────────────────────
               dataset
┏━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ name   ┃ type  ┃ path              ┃
┡━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ chunk1 │ table │ tables/chunk1.csv │
│ chunk2 │ table │ tables/chunk2.csv │
└────────┴───────┴───────────────────┘
──────────────────────────────────── Tables ────────────────────────────────────
     chunk1
┏━━━━┳━━━━━━━━━┓
┃ id ┃ name    ┃
┡━━━━╇━━━━━━━━━┩
│ 1  │ english │
└────┴─────────┘
    chunk2
┏━━━━┳━━━━━━━━┓
┃ id ┃ name   ┃
┡━━━━╇━━━━━━━━┩
│ 2  │ 中国人 │
└────┴────────┘

Yaml/Json Mode

It's possible to output as YAML or JSON, for example:

frictionless extract tables/*.csv --yaml
chunk1:
- id: 1
  name: english
chunk2:
- id: 2
  name: 中国人