Closed edelooff closed 4 years ago
Ok nice. So existing (Nested)MutableJson class still works but is now instantiated from mutable_json_type()
- which optionally replaces (Nested)MutableJson.
This is great. sqlalchemy-json will now work with TEXT colums in any database. Such as MySQL TEXT/LONGTEXT columns.
MariaDB doesn't have native JSON column type but aliases JSON to LONG for MySQL compatibility which works totally fine. They argue they get equivalent performance without having native JSON column implementation. https://mariadb.com/kb/en/json-data-type/
Our CI pipelines run fine using either JsonEncodedDict
or mutable_json_type()
.
and alembic autogenerate says no pending changes which is good.
Seems fine to me - anything specific to test/look for?
@morganchristiansson nothing specific to test, but a second pair of eyes helps, in addition to testing on MySQL/MariaDB as I don't have those ready to go here. I think that settles this PR, and should solve the regression introduced in 0.3.0.
This adds a function
mutable_json_type
to create the actual column types for nested mutable structures, which resolves #22. Conveniently, this also exposes the actual storage type to tools like Alembic, which will now correctly try to create a table with asa.JSON
type.It also fixes a regression bug introduced in #23 whereby SQLite (and potentially other engines) will no longer function due to not having a native JSON type for SQLAlchemy to interact with.