News for hackers. Stuff that matters.

groue

Re:Start all of your commands with a comma on Saturday February 07, 2026 @11:23AM (#46925026)
Gentium is a very beautiful font: https://software.sil.org/gentium/
Re:Ask HN: How do you get over the fear of sharing code? on Sunday November 09, 2025 @05:01PM (#45869629)
You are not your code.
Yes. GRDB encourages Codable because the user can profit from the code generated by the compiler, and this implies that database values are accessed by column name, on top of the Codable runtime, and those layers have a high cost. When necessary it is possible to access database values by position, and in this case GRDB achieves speed of light (performance nearly identical as raw SQLite).
You're welcome :)
Thank you (GRDB author here).

It is not mentioned in the README of the repository, but SQLiteData wraps GRDB to access the database and get notified of database changes (the meat and butter).

GRDB is by itself a solid "toolkit for SQLite databases, with a focus on application development", with both high levels APIs for everyday coding, and expert SQLite features for the demanding developers. Many apps rely on GRDB alone.

Re:Why SQLite Uses Bytecode on Tuesday April 30, 2024 @06:38AM (#40209435)
Out of curiosity, I asked on the SQLite forum how the query optimizer fits in this schema: https://sqlite.org/forum/forumpost/93f9bfcec0
Re:Quirks, Caveats, and Gotchas in SQLite on Thursday October 20, 2022 @03:48PM (#33279754)
I do, for JSON columns. I store UTF8 strings in SQLite, so that it is easy to see JSON values with a plain `SELECT *`). And I load blobs, because I code in Swift and the standard JSON decoder eats raw UTF8 memory buffers, not strings.

This avoids two useless conversions:

- first from a C string loaded from SQLite to a Swift Unicode string (with UTF8 validation).

- next from this Swift Unicode string to a UTF8 memory buffer (so that JSONDecoder can do its job).

SQLite is smart enough to strip the trailing \0 when you load a blob from a string stored in the database :-)

Re:SQLite B-Tree Module on Sunday April 03, 2022 @10:24AM (#30897148)
Yes. Now, many short writes look exactly as one very long write from the point of view of an enqueued write that is waiting for its turn :-) I don't quite remember how fair is SQLite scheduling, in practice.
Re:SQLite B-Tree Module on Sunday April 03, 2022 @10:13AM (#30897061)
What's cool with WAL mode is that SQLITE_BUSY won't happen for readers (except very rare scenarios: https://www.sqlite.org/wal.html#sometimes_queries_return_sql...)

One should only expect SQLITE_BUSY for writes (if a writer is already holding the lock, and the busy timeout expires before the other writer releases the lock). So yes, prefer short writes, or adjust your timeout. Generally speaking, SQLITE_BUSY can not be 100% prevented for writes.

Re:SQLite B-Tree Module on Sunday April 03, 2022 @10:04AM (#30896994)
It is always safe, and by "safe" I mean "safe for data". You won't have to deal with data corruption. Precisely, see "How To Corrupt An SQLite Database File": https://www.sqlite.org/howtocorrupt.html

Now concurrent accesses from different processes/connections can lead to runtime errors (SQLITE_BUSY), because the database happens to be locked by one connection.

Those errors are greatly reduced by the WAL mode (https://sqlite.org/wal.html) which provides ultra-robust single-writer/multiple-readers semantics:

- Writes can not happen concurrently (SQLITE_BUSY).

- One can reduce the occurrences of such SQLITE_BUSY errors by using a built-in timeout (https://www.sqlite.org/c3ref/busy_timeout.html).

- Several reads can happen concurrently, including with writers.

- A writer connection can enter the "Serializable" isolation level.

- A reader connection can enter the "Snapshot Isolation" level.

For more details, see https://www.sqlite.org/isolation.html

During all the years I've been developing the GRDB library (https://github.com/groue/GRDB.swift), I could never see SQLite fail its documented guarantees. This made it possible to build one of the most concurrency-focused SQLite toolkit for Swift, and I'm pretty happy with it (https://github.com/groue/GRDB.swift/blob/master/Documentatio...).

Re:Kind of Bloop (2009) on Monday February 21, 2022 @07:04AM (#30414867)
The music is quite good! The covers of Freddie Freeloader and Flamenco Sketches are quite worth it, IMHO :-)
Re:GRDB 5.17 with async/await (SQLite toolkit for Swift) on Wednesday December 15, 2021 @06:35AM (#29564563)
Library author here - SQLite concurrency needs a little care: don't miss the Concurrency Guide: https://github.com/groue/GRDB.swift/blob/master/Documentatio...
Re:The Laws of Core Data on Tuesday December 22, 2020 @04:28AM (#25504498)
You can try https://github.com/groue/GRDB.swift

It's a thin wrapper around SQLite, with convenience APIs for record types, robust support for concurrency, and a focus on GUI apps.

I often promise myself to have a look at SQLite virtual file system API, for this very purpose, but could not yet find the guts :-)
Re:Solve Less General Problems on Tuesday August 28, 2018 @07:25AM (#17857933)
We start to see ORMs like Diesel (https://diesel.rs) or GRDB (http://github.com/groue/GRDB.swift) that radically simplify their domain by removing traditional ORM features like implicit uniquing, lazy-loading, or auto-updates. This of course gives more work to do on the client side. But this work is positive and often simpler than expected. With traditional ORMs, there is still some work to do, which often looks like fights: against misunderstandings, against leaky abstractions, against configuration levels that don't match the needs of application, and generally speaking against the framework.

ORMs are not done yet :-)

Re:JSON Changelog with SQLite on Tuesday August 28, 2018 @01:59AM (#17856833)
Related article: "Automatic Undo/Redo Using SQLite" https://www.sqlite.org/undoredo.html
Re:What ORMs have taught me: just learn SQL (2014) on Monday December 18, 2017 @03:00AM (#15950172)
There are ORMs that address partial records, multi-threading troubles brought by lazy loading, uniquing, auto-updating records, and, importantly, put raw SQL on the same level as the query builder. I think of [Diesel](http://diesel.rs) and [GRDB.swift](https://github.com/groue/GRDB.swift/blob/master/Documentatio...).
Re:Why we never thank open source maintainers on Thursday November 23, 2017 @01:38PM (#15766986)
I agree. Sometimes, I explain that the feature request can be implemented, but not for free. I flag such issues with the "needs sponsoring" tag.
Re:Practical Guide to SQL Transaction Isolation on Wednesday August 02, 2017 @08:28AM (#14909945)
Unique to GRDB.swift, as far as I know, is the ability to perform database writes and then wait until snapshot isolation has been reached in another connection before releasing the writing lock. This allows to read from a known database state, while allowing other writes to be performed. The ability to read for a precisely known database state allows nice features like database observation and reactive patterns, while taking advantage from the WAL mode by not holding locks longer than necessary.
Re:Practical Guide to SQL Transaction Isolation on Wednesday August 02, 2017 @08:20AM (#14909894)
I'd also like to thank the other for his attempt at raising the general awareness of transaction isolation. Even when you deal with simpler databases like SQLite, isolation is a serious topic. When serializing accesses hinders performances, dealing with the "WAL mode" that grants SQLite with single-writer-multipler-readers abilities is everything but trivial, because of the huge amount of documentation that has to be read in order to reach the desired level of isolation. I've written an SQLite library in Swift that provides by default the snapshot isolation level which grants most developers with both peace of mind, and non-blocking reads. Check out its "concurrency guide" if you're interested: https://github.com/groue/GRDB.swift/blob/master/README.md#co...
Re:Unexpected SQLite with Swift on Wednesday May 03, 2017 @07:24AM (#14254727)
> They sound similar to change data capture in SQLServer.

Yes. There is a difference, though: SQLite is embedded, and there is zero latency between an application and its database.

This means that change notifications can be emitted synchronously right after a committed transaction, allowing the application to process the change before any other change could be performed.

This makes it much easier to get a very robust solution for a whole class of database synchronization problems.

Re:Unexpected SQLite with Swift on Wednesday May 03, 2017 @07:14AM (#14254677)
I didn't know about windowing function. This page looks like a nice description: https://community.modeanalytics.com/sql/tutorial/sql-window-...
Re:Coq 8.6 is out on Wednesday December 14, 2016 @01:21PM (#13178287)
Sure, and French don't have a word for "entrepreneur" neither

Older »