Skip to content

Commit

Permalink
docs(builtins): update csv-lookup and csv-import Readme files
Browse files Browse the repository at this point in the history
  • Loading branch information
manushak committed Dec 6, 2024
1 parent 0ce93d0 commit 32b78ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/if-run/builtins/csv-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,21 @@ The results will be saved to a new `yaml` file in `manifests/outputs`.

## Errors

`CSVImport` exposes six of the IF error classes.
`CSVImport` exposes five of the IF error classes.

### FetchingFileError

This error is caused by problems finding the file at the path provided in the `filepath`. If the file is on your local filesystem, you can check that the file is definitely there. For a remote file, check your internet connection. You can check your connection to the server using a tool such as `ping` or `curl`. if you still experience problems, you could retrieve the remote file onto your local filesystem using a tool such as `wget`.

### ReadFileError,
### ReadFileError

This error is caused by problems reading the CSV file provided in the `filepath`. To fix it, check that the file contains valid CSV data. The file should have a `.csv` file extension and the data inside should be formatted correctly.

### MissingCSVColumnError,
### MissingCSVColumnError

This error is caused by `CsvImport` failing to find a column in the CSV file whose name matches what was provided in `query`. To debug, check that you do not have any typos in your `query` and confirm that the requested column name definitely exists in the target file.

### CSVParseError,
### CSVParseError

This error arises due to problems parsing CSV data into IF. This can occur when the CSV data is incorrectly formatted or contains unexpected characters that IF does not recognize. These errors are expected to be unusual edge cases as incorrectly formatted data will usually be identified during file loading and cause a `ReadFileError`. To debug, check your CSV file for any unexpected formatting or unusual characters.

Expand Down
14 changes: 7 additions & 7 deletions src/if-run/builtins/csv-lookup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`csv-lookup` is a generic plugin that enables you to select arbitrary data from a given csv file and add it to your manifest file's `input` data.

You provide path to the target csv file pus some query parameters. The filepath can point to a location on the local filesystem or it can be a URL for an online resource. The query parameters include the column names for the target data you want to return (can be one column name, multiple column names or all column names, indicated using `"*"`), plus the column names and values you want to use as selectors.
You provide path to the target csv file plus some query parameters. The filepath can point to a location on the local filesystem or it can be a URL for an online resource. The query parameters include the column names for the target data you want to return (can be one column name, multiple column names or all column names, indicated using `"*"`), plus the column names and values you want to use as selectors.

For example, for the following CSV:

Expand Down Expand Up @@ -33,7 +33,7 @@ Notice that the query parameters are key/value pairs where the key is the column
- `query` - an array of key/value pairs where the key is a column name in the target csv and the value is a parameter from inputs
- `output` - the columns to grab data from and add to output data - should support wildcard or multiple values.

The plugin also supports data renaming. This means you can grab data from a named column but push it into your manifest file data under another name, for example, maybe we want to grab data from the `processor-name` column int he target csv and add it to the manifest file data as `processor-id` because this is the name expected by some other plugin in your piepline. You can do this by passing comma separated values in arrays.
The plugin also supports data renaming. This means you can grab data from a named column but push it into your manifest file data under another name, for example, maybe we want to grab data from the `processor-name` column in the target csv and add it to the manifest file data as `processor-id` because this is the name expected by some other plugin in your piepline. You can do this by passing comma separated values in arrays.

```yaml
output: ['processor-name': 'processor-id']
Expand Down Expand Up @@ -175,25 +175,25 @@ The results will be saved to a new `yaml` file in `manifests/outputs`.

## Errors

Coefficient exposes six of the IF error classes.
`CSVLookup` exposes six of the IF error classes.

### FetchingFileError

This error is caused by problems finding the file at the path provided in the `filepath`. If the file is on your local filesystem, you can check that the file is definitely there. For a remote file, check your internet connection. You can check your connection to the server using a tool such as `ping` or `curl`. if you still experience problems, you could retrieve the remote file onto your local filesystem using a tool such as `wget`.

### ReadFileError,
### ReadFileError

This error is caused by problems reading the CSV file provided in the `filepath`. To fix it, check that the file contains valid CSV data. The file should have a `.csv` file extension and the data inside should be formatted correctly.

### MissingCSVColumnError,
### MissingCSVColumnError

This error is caused by `CsvLookup` failing to find a column in the CSV file whose name matches what was provided in `query`. To debug, check that you do not have any typos in your `query` and confirm that the requested column name definitely exists in the target file.

### QueryDataNotFoundError,
### QueryDataNotFoundError

This error is caused by the `CsvLookup` plugin failing to find data that matches your query. Try revising your query parameters.

### CSVParseError,
### CSVParseError

This error arises due to problems parsing CSV data into IF. This can occur when the CSV data is incorrectly formatted or contains unexpected characters that IF does not recognize. These errors are expected to be unusual edge cases as incorrectly formatted data will usually be identified during file loading and cause a `ReadFileError`. To debug, check your CSV file for any unexpected formatting or unusual characters.

Expand Down

0 comments on commit 32b78ab

Please sign in to comment.