I need to store JSON in Azure SQL Database, e.g.:
id something json_document
1 Foo West {"p1":3, "p3":4}
2 Foo East {"p1":13, "p3":34}
3 Foo North {"p1":23, "p3":44}
Recently Microsoft announced better support for storing JSON in thier SQL databases: https://learn.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-2017 . Is there a way to use this feature with SQLAlchemy's ORM?
What I'd love to have it something along these lines:
class Mytable(db.Model):
id = db.Column(db.Integer(), nullable=False, primary_key=True, )
something = db.Column(db.String(100))
json_document = db.Column(db.JSON())
so then I could do
db.session.add(Mytable(something="XYZ",
json_documnet=json.dump({"p1":123})))