#grdb — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #grdb, aggregated by home.social.
-
Noticed different behavior in a couple of text fields with number formatters. On one I could type an aperture (e.g. 5.6) and it only finalizes the formatting on submit. The other is greedy and tries to format as you type, so that 5.6 ends up as f/56.
I tracked it down to different flows for handling selection. The misbehaving one has a direct database query in the view, so I think when the model changes the view invalidates, and the text field formats
-
New Swift Package adds a window in SwiftUI apps to show database details (including filepath, schema, and the data from rows of tables) for a SQLite database using the #GRDB package/library. Only tested on macOS so far, but probably usable on other platforms. https://gitlab.com/grantneufeld/GRDBDatabaseInspectorUI
-
@groue I opened a new discussion here:
https://github.com/groue/GRDB.swift/discussions/1821
Will describe the changes in a couple of parts to make it more manageable to write/read.
-
Apart from some minor tests that probably fail because of Linux specific things, actually most failures are in the DatabasePoolConcurrencyTests. Need to see whether this also occurs on macOS, and if not see what's causing this on Linux #swift #swiftlang #linux #grdb #sqlite
-
Fixed the build of GRDB on Linux and now trying to fix the failing tests. More than 400 tests are failing so it was difficult to see which tests were, but luckily I found:
-
🚀 I've just shipped #GRDB v7.6.1, that fixes a race condition introduced three days ago in v7.6.0: Please upgrade!
Version 7.6 makes it possible to access Task locals from async database accesses. This improves GRDB integration with toolings that rely of Task locals. For example, your tests can now use the #expect macro from within an async database access.
-
Happy birthday, #GRDB! The first recorded commit was on June 30, 2015 🎂
-
New blog post: Caveats Using Read-only SQLite Databases from the App Bundle
https://twocentstudios.com/2025/06/07/sql-databases-bundle/
A quick debugging story where I learnan some new things about SQLite's journal mode while building an database export/import feature for Eki Live.
TLDR:
- Journal mode is embedded in the sqlite database file itself.
- The `backup` command changes the journal mode of the target database to match the source database.
- Check the journal mode of a database with `sqlite3 db.sqlite "PRAGMA journal_mode;"`.
- Change the journal mode of a database with `sqlite3 db.sqlite "PRAGMA journal_mode=DELETE;"`. -
I have a nice #GRDB branch that simplifies the definition of SQLite requests from Swift code:
// 🙄 String-based (current state of the lib)
Player.filter(Column("score") > 1000)// 😐 Enum-based (current state of the lib)
Player.filter(Player.Columns.score > 1000)// 🤩 NEW
Player.filter { $0.score > 1000 }It comes for free for record types that follow the recommended practices (i.e. define a nested `Columns` enum). 🎁
The commit that updates the demo app shows a nice win, at +9/-44 https://github.com/groue/GRDB.swift/commit/261c0ccf866029c0f65a88b881aabf46effc4f9e
The problem is that it breaks apps that define their records in packages/frameworks. The `Columns` enum must become `public` when the record type is, or the compiler won't compile it (even if its members are not public). 😖
In order to avoid the breaking change, I'll have to choose a name that is not `Columns`.
TableColumns? RecordColumns? Cols? Col? C?
In my own practice, this type sometimes contains expressions that are not columns, as below. Maybe the name should not refer to "columns", after all. TableLayout? TableComponents? SQLElements?
enum Columns {
// The date column
static let start = Column(CodingKeys.start)// An expression derived from the date column
static let startDateUTC = SQL("date(\(Columns.start))").sqlExpression
} -
I've been building out the updated database and noticed queries weren't joining the lens information. The camera and film stock loaded and the queries didn't have any typos. Eventually I tracked down the issue to GRDB's pluralization support: “lens” looks plural so it was attempting to load values from a table called “len”. Luckily overriding the name was easy enough
-
https://github.com/inlinehq/GRDB.swift
friendly fork of GRDB with SQLCipher included. (for various reasons, this isn't practical with SPM and GRDB.) this just caught my eye as a migration path for Feditext's GRDB+SQLCipher fork; hopefully it's backwards-compatible.
-
Reading pre-WWDC summaries and wish lists, I’m starting to think that going with #SwiftData for my toy podcast player wasn’t the best idea. Plain old #SQLite wrapped in #GRDB and Harmony or similar for CloudKit sync is beginning to look more and more appealing. SwiftData seems to have too many bugs, corner cases and gotchas. I’ll see what WWDC brings.
-
Did you know #GRDB can run on Windows? I just learned that today: https://github.com/groue/GRDB.swift/discussions/1498
-
#GRDB 7 will drop CocoaPods support.
Some folks will be able to migrate to SPM. But folks who use GRDB+#SQLCipher will be stuck with GRDB 6.
I'm not pleased with the situation, so please chime in the linked discussion below: your experience may help!
-
The development of #GRDB 7 has started :-) Don't expect anything big - I'll focus on strict Swift concurrency, fixing a few api annoyances, and bumping the minimum Swift version.
-
#GRDB Tip of the Day! Users who share a database between multiple processes (think App Group Container, App Extensions, etc.) should configure their connections so that write transaction can't overlap. More information in the "How to limit the SQLITE_BUSY error" section of the Guide for Sharing a Database: https://swiftpackageindex.com/groue/grdb.swift/documentation/grdb/databasesharing#How-to-limit-the-SQLITEBUSY-error
-
Recent #iOS development journal on data #persistency
1. Implemented everything with #UserDefaults and raw file system
2. Feeling in need of a higher level abstraction
3. #SQLite is too much for now, and I don't want to bother with schema migration on a client device
4. Core Data looks what I need, but friends warned me to avoid it
5. #GRDB seems to hold a good reputation comparing to Core Data
6. Let me try Core Data, it seems to improved a lot recently -
🚀 #GRDB 6.19.0 has shipped, with extended support for JSON: https://swiftpackageindex.com/groue/grdb.swift/documentation/grdb/json. Full release notes: https://github.com/groue/GRDB.swift/releases/tag/v6.19.0 Thank you to contributors 👍
-
I'm polishing a #GRDB pull request that lets you deal with JSON values at the SQLite level (access to subcomponents by key or JSON path, indexes on json expressions, support for strict and flexible JSON schemas, and more). If you're interested, please chime in: the PR comes with a rather complete description, and new APIs are already fully documented https://github.com/groue/GRDB.swift/pull/1436
-
The #GRDB question of the day is "What's the right way to use auto-incremented primary keys?" Thank you for asking, because there's a lot to say 🤓 https://github.com/groue/GRDB.swift/issues/1435#issuecomment-1740857712 There's also a paragraph about @pointfreeco's Tagged, because it is so useful.
-
Turns out that if you don’t implement your #GRDB migrations correctly, then your data won’t be updated. On reflection, this seems fair 😂
The problem was that I was making a change to a migration, testing it, then adding another change but I didn’t tell GRDB to destroy the schema at that point. So, it made the first change in the migration, then (correctly) ignored all the other changes…!
-
Reliable database observation is not easy, and #SwiftData in Xcode 15 RC still has some holes to fill: https://mastodon.social/@helge/111060086293442683. Shameless plug: the Swift SQLite toolkit #GRDB always keeps your views up to date and never misses a single change, because its observation engine is based on the SQLite authorization callbacks (the built-in SQLite "firewall"). By design, it is impossible to miss changes when all of them have to be authorized first! #KnowYourTools
-
Thel made a nice #GRDB tutorial on Youtube: https://www.youtube.com/watch?v=11AMFUH6rro
-
Wrote about the GRDBQuery helpers I keep reusing. GRDBQuery doesn't depend on GRDB, so opening a PR wouldn't wok.
https://github.com/groue/GRDBQuery/issues/39#ios #iodeveloper #grdb #sqlite #swiftui #swiftlang #swiftdeveloper
-
Wrote about the GRDBQuery helpers I keep reusing. GRDBQuery doesn't depend on GRDB, so opening a PR wouldn't wok.
https://github.com/groue/GRDBQuery/issues/39#ios #iodeveloper #grdb #sqlite #swiftui #swiftlang #swiftdeveloper
-
Wrote about the GRDBQuery helpers I keep reusing. GRDBQuery doesn't depend on GRDB, so opening a PR wouldn't wok.
https://github.com/groue/GRDBQuery/issues/39#ios #iodeveloper #grdb #sqlite #swiftui #swiftlang #swiftdeveloper
-
Wrote about the GRDBQuery helpers I keep reusing. GRDBQuery doesn't depend on GRDB, so opening a PR wouldn't wok.
https://github.com/groue/GRDBQuery/issues/39#ios #iodeveloper #grdb #sqlite #swiftui #swiftlang #swiftdeveloper
-
Wrote about the GRDBQuery helpers I keep reusing. GRDBQuery doesn't depend on GRDB, so opening a PR wouldn't wok.
https://github.com/groue/GRDBQuery/issues/39#ios #iodeveloper #grdb #sqlite #swiftui #swiftlang #swiftdeveloper