gristlabs / grist-desktop

Desktop Grist, packaged with Electron
Apache License 2.0
154 stars 7 forks source link

How to work directly with postgres db from the cli in Grist Electron? #19

Closed ReedyBear closed 9 months ago

ReedyBear commented 9 months ago

I just want to use the postgres cli to access & manipulate my data, but I can't figure out how to connect to it. I don't currently have postgres installed on my system, so I assume it is stored on-disk somewhere in user storage.

I found the grist files at ~/.config/grist-electron/ and a file ~/Documents/[random_chars].grist on linux Fedora.

I can't find the postgres db though & I didn't see an answer at https://support.getgrist.com/self-managed/#what-files-does-grist-store

paulfitz commented 9 months ago

Hi @ReedyBear, if you haven't explicitly configured Grist to use postgres, then it is using sqlite. For Grist electron, I think the file is called landing.db and looks to be stored wherever path.resolve(electron.app.getPath('appData'), 'landing.db') would be.

ReedyBear commented 9 months ago

@paulfitz, thanks! When I looked at sqlite3 ~/Documents/[random_chars].grist, I overlooked my actual tables, but they're in there. I was curious about syncing my grist db with a mysql db, so needed raw access. Probably going with a different solution that works seamlessly with MySql (like NocoDb), even though Grist seems to be the best UX of options I've looked at.

For reference, here's how things got setup by default on my Fedora system using grist-electron's AppImage:

Running the AppImage from the cli was helpful, in order to see some file paths in the logs.

paulfitz commented 9 months ago

Thanks for the feedback on what you learned @ReedyBear. Agree that for working directly with MySQL, Grist is not the tool to go with today.