Show HN: Google Drive to SQLite (simonwillison.net)
Here's the repo: https://github.com/simonw/google-drive-to-sqlite
The README is using a trick I'm increasingly leaning on: parts of that document - the --help output and the example database schema - are automatically generated using Cog: https://nedbatchelder.com/code/cog and https://til.simonwillison.net/python/cog-to-update-help-in-r...
34 comments
[ 2.9 ms ] story [ 92.5 ms ] threadHere is the google page: https://developers.googleblog.com/2022/02/making-oauth-flows...
Here is the discussion on the rclone issue - there are links to more stuff there: https://github.com/rclone/rclone/issues/6000
Luckily rclone already implements the oauth webserver for other backends, but for tools like this it has suddenly made authenticating with Google a whole lot harder.
Do I need to spin up a localhost web server on a port instead? How am I supposed to do that sensibly on a remote server that I'm SSHing into?
Also that announcement seemed to indicate that localhost: redirects were going to be disabled too, wouldn't that make the local web server option not work either?
I swear, obtaining an OAuth token to interact with my Google account is the new hardest problem in computer science. Oh for a GitHub-style personal access token!
It looks like the localhost redirects are being disabled for "iOS, Android and Chrome app OAuth client types" so hopefully I can still use those by spinning up a localhost web server after all.
Either you're a sticky customer and you'll figure it out,
or you're a high value customer that they'll sick an engineer or two on for a week to re-tool.
They do. not. care.
This aligns with what nearly all the other cloud providers do with oauth.
> How am I supposed to do that sensibly on a remote server that I'm SSHing into?
If you want to see rclone's solution then check out
https://rclone.org/remote_setup/
It's a bit of a pain!
> Also that announcement seemed to indicate that localhost: redirects were going to be disabled too, wouldn't that make the local web server option not work either?
As you noted below that is only for Android, IOS and ChromeOS. I hadn't noticed that before though...
> I swear, obtaining an OAuth token to interact with my Google account is the new hardest problem in computer science.
Ha ha!
I note that you can get "rclone authorize" to do it if you want as you can set the scopes and the client id / client secret.
It wasn't T.J Holowaychuk but it was that time. Google doesn't give me shit but back in 2010 there was one post that everyone was working against.
[0]https://takeout.google.com/
How does this interact with IDEs? Has anyone written a VSCode extension yet? I'd probably be reluctant to use something like this without IDE support. (Though I may well be in the minority, and I appreciate that for open source tools it's not necessarily reasonable to expect people to dedicate so much of their time to DX.)
I use VS Code's markdown preview panel, which updates automatically when I manually run the "cog -r" command.
I've developed a simple "codeblocks" tool that to keep README.md up-to-date. In your example, here is how to insert the latest `--help` output:
Where "usage-auth" is the block language in README.md: Checking is also possible: It's not as generic as cog, but does not require writing codegen scripts inside Markdown file.https://github.com/shamrin/codeblocks
https://www.alfredforum.com/topic/17318-google-drive-%E2%80%...
Thanks simonw - neat stuff
I have been working with it to gather ecom sales data across platforms for a couple of months. Such a powerful tool! I want to do more with it!
I used to be the lead on Syncplicity, a desktop file synchronization product. All of the local state was in SQLite. Early versions of the desktop client kept the complete path to every file in the associated row in SQLite. Later versions kept the filename and foreign key to the directory row.
Bittorrent Sync (I forget its new name) also used to use a SQLite database for local metadata.
And, finally: It's not that hard to write a tool to recursively scan a folder and grab all the metadata of files. You can scan 1000s of files in a matter of seconds.
I would:
- sync the GDrive locally
- setup "search anything service" from voidtools
Voila. A super fast programmable index of the files.
If you want to dump it to SQLite, go ahead.
Ps. Applicable to Dotnet
Note: file owners wouldn't be known.
It's pretty easy to get rate limited so it could take days or weeks to build an index (so having a tool that talks to the API is generally more reliable)
Just want to say thanks for sharing these valuable projects and keep up the great work!
I hope to be able to contribute something back to Datasette in the future. (code is at https://gitlab.wikimedia.org/releng/ddd/ but probably not anything that could be merged back into the core, it's just custom extension code on top of datasette)
I love that this is a public repo - I'm definitely going to be pointing people to it as an example of the kind of thing you can build.
Thanks for sharing that!
A lot of inspiration was taken from https://github.com/rclement/datasette-dashboards. I started out by trying to extend that project. I ended up abandoning that idea and started fresh once I realized how much my requirements diverged from the capabilities and direction of rclement's plugin.
Thanks for making such a remarkably extensible architecture and especially for the great documentation. It's been a real pleasure working with datasette and I look forward to doing some more work on datasette plugins in the future.