Skip to content

Sqlite - #8386

Closed
marcelowa wants to merge 3 commits into
rclone:masterfrom
marcelowa:sqlite
Closed

Sqlite#8386
marcelowa wants to merge 3 commits into
rclone:masterfrom
marcelowa:sqlite

Conversation

@marcelowa

Copy link
Copy Markdown

What is the purpose of this change?

Add a new backend: SQLite

Checklist

  • [x ] I have read the contribution guidelines.
  • [ x] I have added tests for all changes in this PR if appropriate.
  • [x ] I have added documentation for the changes if appropriate.
  • [ x] All commit messages are in house style.
  • [ x] I'm done, this Pull Request is ready for review :-)

@marcelowa marcelowa mentioned this pull request Feb 13, 2025
@ncw

ncw commented Feb 13, 2025

Copy link
Copy Markdown
Member

This is a fun idea!

Unfortunately there is a problem with github.com/mattn/go-sqlite3 as it requires CGO. We build rclone without CGO support to maximise portability.

It does get built with CGO support on Windows and macOS to use libfuse. However we don't link the rclone binary against libfuse which means as long as you don't run rclone mount you don't need to install fuse.

It looks like go-sqlite3 includes the sqlite code within it - it doesn't seem to be using the shared library which is good.

There are alternatives to github.com/mattn/go-sqlite3

However rclone does include a very powerful built in database lib/kv which is based on https://pkg.go.dev/go.etcd.io/bbolt

If you re-worked your db to use that package then it would be easy to merge.

Another idea is you keep this as a plugin: https://pkg.go.dev/github.com/rclone/[email protected]/lib/plugin

I'll run the CI now and we can see what blows up.

@darthShadow

Copy link
Copy Markdown
Member

https://github.com/ncruces/go-sqlite3 is also an option. It uses the WASM build of sqlite.

@marcelowa

marcelowa commented Feb 13, 2025 •

Copy link
Copy Markdown
Author

@ncw thanks for the great feedback!
Although "cvilsmeier/sqinn-go" doesn't look like an active project (last commit in 2023), "modernc.org/sqlite" and "ncruces/go-sqlite3" which @darthShadow suggested look like viable options, I'll check both of them!
I also saw that the lint didn't pass with small issues, I'll fix the issues
about lib/kv I don't mind implementing an additional backend :)

@marcelowa

marcelowa commented Feb 13, 2025 •

Copy link
Copy Markdown
Author

I ended up using "ncruces/go-sqlite3" because "modernc.org/sqlite" didn't behave well
Also fixed all the lint issues

@marcelowa

Copy link
Copy Markdown
Author

@ncw can you please run ci again?
Thanks

@ncw

ncw commented Apr 9, 2025

Copy link
Copy Markdown
Member

@marcelowa shall we close this in favour of #8445 ?

@marcelowa marcelowa closed this Apr 14, 2025
@pyhedgehog

Copy link
Copy Markdown
Contributor

bolt is go-only format. It's not equal replacement for sqlite3 that is supported worldwide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants