Open amotl opened 1 year ago
A bit of progress with crate/crate-python#561.
cache_ok = False
on the OBJECT
type implementation. Unfortunately, this detail did not change, even when using the data casters instead of pure indexed access by key.That patch may include more improvements in this area.
About
crate/crate-python#559 revealed that the SQLAlchemy implementation for supporting CrateDB's
OBJECT
type has drawbacks when accessing the attributes of the dictionary facade by key, i.e. indexing into the dictionary using the classicalEntity.field["attribute"]
notation.Thoughts
Here, we are trying to outline a possible alternative way of implementing support for that, which may more closely align to PostgreSQL's JSON type support. While CrateDB itself does not provide support for the JSON|JSONB types, the same SQLAlchemy interface could still be leveraged to access CrateDB's
OBJECT
type in the same spirit. At least, this is what I am assuming for now.Details
Please inspect SQLAlchemy's
sqltypes.JSON
type implementation, which is provided as a facade for vendor-specific JSON types, which are currently PostgreSQL, MySQL, SQLite, and Microsoft SQL Server. Each of them has their own specializations, so I think the chance to re-use some code from the generic type variants for implementing CrateDB'sOBJECT
type might actually be possible.New interface
The new interface to index operations is based on data casters.
Code examples
When adhering to the new interface, the same statement would be written slightly different.
Before
After