-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
31 lines (20 loc) · 807 Bytes
/
cli.py
File metadata and controls
31 lines (20 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import click
def my_dh_query(input_file: str, verbose: bool = False):
"""Read a CSV file and perform a simple query operation on the data."""
from deephaven import read_csv
if verbose:
click.echo(f"Processing {input_file}...")
source = read_csv(input_file)
result = source.update(formulas=["DoubleScore = Score * 2"])
if verbose:
click.echo(f"Processed {result.size} rows")
return result
@click.command()
@click.argument("input_file", type=click.Path(exists=True))
@click.option("--verbose", "-v", is_flag=True, help="Enable verbose output")
def app(input_file: str, verbose: bool) -> None:
"""Process data with Deephaven."""
result = my_dh_query(input_file, verbose)
click.echo("Processing complete!")
if __name__ == "__main__":
app()