CGI-FR / CGI-FR/LINO

Add JSONL file input support for the `lino query` command

Open
#425 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
23
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Currently, the `lino query` command allows executing SQL queries directly from the command line, but it does not support JSONL files as input. This limits flexibility and automation for processing larger or structured datasets.

**Need:** Enhance the `lino query` command to accept JSONL files as input. This would enable more flexible and automated query processing.

**Proposed Solution:**

1. **Modify the `lino query` command:**

- Add an option to specify a JSONL file as input.
- For example, a new option `-F` or `--filter-from-file` could be added to indicate that the input is a JSONL file.
2. **JSONL File Format:**

- A JSONL file is a file where each line is a valid JSON object.
- Example `input.jsonl` file:

```
{"param1": "value1"}
{"param1": "value2"}
{"param1": "value3"}

```

3. **Example Usage with a JSONL File:**

```
lino query -F input.jsonl --binding v1=param1 'SELECT result FROM table WHERE column=:v1'

```

- This command would read each line of the `input.jsonl` file, extract the value of `param1`, and execute the query for each line.
4. **Data Processing:**

- For each line in the JSONL file, the command would extract the necessary parameters.
- The SQL query would be executed for each set of parameters.
- Results is stream line by line to the output.

5. **Output:**

- The output is a stream of JSONL results, where each line corresponds to the query result for each input.
- Example output:

```
{"result": "result1"}
{"result": "result2"}
{"result": "result3"}

```

**Benefits:**

- Increased flexibility for processing larger and structured datasets.
- Automation of queries using JSONL files as input sources.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.