Skip to main content

Data Operations

This page is mainly for skill authors, delivery engineers, and Agent maintainers. Business users usually describe the business goal, while the Agent decides which data commands to run.


What the data command family is for​

data is the most frequently used runtime group in Lovrabet CLI. It mainly covers:

  • reads: find lists, inspect a single record, produce grouped summaries
  • writes: create, update, batch-create, and delete

Common commands:

  • data filter
  • data getOne
  • data aggregate
  • data create
  • data batchCreate
  • data update
  • data delete

The two arguments you will almost always use​

Most data commands revolve around:

  • --code: the dataset code
  • --params: the JSON payload

In practice, the Agent usually learns or discovers the dataset code first, then passes the correct --params.


Read actions​

data filter​

Best for:

  • list queries
  • condition-based filtering
  • detail lists
lovrabet data filter --code <datasetCode> --params '{"where":{"status":{"$eq":"active"}},"currentPage":1,"pageSize":20}'

data getOne​

Best for:

  • checking a single record
  • confirming the current state of one item
lovrabet data getOne --code <datasetCode> --params '{"id":123}'

data aggregate​

Best for:

  • grouped summaries
  • operational reporting
  • reconciliation and management totals
lovrabet data aggregate --code <datasetCode> --params '{
"aggregate":[{"field":"amount","type":"SUM","alias":"total"}],
"groupBy":["status"]
}'

Write actions​

data create​

lovrabet data create --code <datasetCode> --params '{"name":"test"}'

data batchCreate​

lovrabet data batchCreate --code <datasetCode> --params '[{"name":"a"},{"name":"b"}]'

data update​

lovrabet data update --code <datasetCode> --params '{"id":123,"status":"completed"}'

data delete​

lovrabet data delete --code <datasetCode> --params '{"id":123}' --yes

Two things to remember before writing​

First: use --dry-run​

lovrabet data update --code <datasetCode> --params '{"id":123,"status":"completed"}' --dry-run

--dry-run shows what would happen without actually executing the write.

Second: check the risk level​

  • create, batchCreate, and update are write
  • delete is high-risk-write

If the current riskLevel is too low, the CLI will block the operation.
For high-risk deletes in non-interactive mode, --yes is also required.


Common filter operators​

OperatorMeaning
$eqequals
$nenot equals
$gt / $gtegreater than / greater than or equal
$lt / $lteless than / less than or equal
$inin a set
$containcontains substring
$startWith / $endWithstarts with / ends with
$and / $orcombined conditions

Example:

lovrabet data filter --code <datasetCode> --params '{
"where":{
"$and":[
{"amount":{"$gte":100}},
{"status":{"$eq":"active"}}
]
}
}'

Common aggregate types​

TypeMeaning
SUMsum
COUNTcount
AVGaverage
MAX / MINmaximum / minimum

How business users should think about this​

Business users do not need to say:

“Please run data aggregate.”

They should say:

“Group unshipped orders from the last 7 days by warehouse.”

or:

“Change ticket 241 to processing. Preview first.”

That makes it easier for the Agent to choose filter, aggregate, update, or an earlier discovery step.