Synchonization with sqlite CLI


I was using grist-electron so far for simple applications. I have concurrently setup the grist docker container (on premises), which works very well, users can update their data and changes are synchronized on the various browsers they use.

I am bumping into a glitch, though, when I concurrently run sqlite scripts from the CLI. The data in the Grist document (database) is updated without any problem. However, the data does not show up on the Grist app (in the browsers), which in turns creates problems when users are trying to create new records (the id of which is already created by the sqlite script).

The data only updates when all users quit their app, and then restart it. The additional data which was added by the sqlite script then appears in the browsers.

Is there a way to get the synchronization to occur without users having to quit their Grist app?

Thanks in advance!

Hmm if changing data in a document externally via SQlite, one brute force way to let Grist know that happened is by forcing a “reload”. There is an undocumented but stable endpoint for that. The URL to hit would be:

http(s)://[...however users are reaching grist...]/api/docs/[document ID]/force-reload

and you should POST to it (an empty body is fine). The effect should be for the document to reload for anyone accessing it, and they should see the latest version.

Let me know if that needs more explanation. Document history will be unreliable since it only records changes made by Grist.

Thanks for the input!

I used the following curl command, and the browsers updated like a charm!

curl -v -X POST -H “Authorization: Bearer ”

Thanks again, this helped a lot!

Corrected curl command:

curl -v -X POST -H “Authorization: Bearer ” http:/:8484/o/docs/api/docs//force-reload

-v (verbose) is just to see the result of the curl command during tests.

Sorry again, I was using <> characters, and part of the command kept disappearing

curl -v -X POST -H “Authorization: Bearer [add API key]” http://[proper IP address]:8484/o/docs/api/docs/[add grist document ID]/force-reload

1 Like