cozodb / cozo

A transactional, relational-graph-vector database that uses Datalog for query. The hippocampus for AI!
https://cozodb.org
Mozilla Public License 2.0
3.44k stars 108 forks source link

What is the params argument for in the C library? #227

Open crystalthoughts opened 10 months ago

crystalthoughts commented 10 months ago

Hi, there doesn't seem to be any documentation for what 'parameters' are expected by the API.

I was looking for a way to limit or prevent returning very large strings after a large data input query. One might assume this might be a passed param, but perhaps it means something different.

Could you advise on the above? Thanks

swdunlop commented 6 months ago

It appears to be a JSON encoded map, looking at cozo.go which wraps the C library for Go. That said, the cozo_test.go doesn't actually use this at all -- so it is not obvious to me what this from either the C or Go wrappers.

The Python wrapper, however, has this:

res = client.run('?[] <- [[$name]]', {'name': 'Python'})

And that probably is enough of an example to figure it out. The parameters are a JSON object whose fields you can reference from Cozoscript to parameterize a query.