Is this still true? > *SQLite*: No native JSON...
# exposed
s
Is this still true?
SQLite: No native JSON type, so
json()
maps to TEXT, while
jsonb()
throws.
https://jetbrains.github.io/Exposed/data-types.html#how-to-use-database-enum-types I see however that SQLite does have json & jsonb support, unless Exposed uses an earlier version of SQLite that does not support these? Is there a way to specify which version of SQLite is used with Exposed if this is the case? https://www.sqlite.org/json1.html I appreciate the clarification on this, Thanks 🙏
j
The sqlite json and jsonb support is purely in validation and mapping functions, not types
s
Thank you for your reply. My question then becomes does using jsonb with sqlite still throw an error? is it supported with Exposed? Because it sounds like jsonb is actually possible in sqlite unlike what the Exposed documentation says. Also are those mapping & validation functions available with Exposed? Thanks again.
j
You can view the column type mappings per vendor in the source https://github.com/JetBrains/Exposed/blob/main/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/vendors/DataTypeProvider.kt and the sqlite overrides https://github.com/JetBrains/Exposed/blob/main/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/vendors/SQLiteDialect.kt Looks like it’s still is accurate. Though I would speculate this is just because sqlite doesn’t support the common json query expressions some other sql dbs do, and you could still store jsonb as a blob if you’re so inclined
1