I have an sql alchemy class that I use called Feature.
class Feature(DBConnect.Base):
__tablename__ = 'feature'
id = Column(Integer, primary_key=True)
name = Column(String(500), nullable=False, default='')
In other code I can get a feature by doing:
feature = db.session.query(Feature).get(10)
And I end up with a feature object. Is there away to do a stored procedure or more complicated query like so:
select * from feature f
join aligned_data_column a on a.id=f.aligned_Data_column_id and
a.aligned_data_id=76
where a.aligned_data_id=70
union
select * from feature f
join aligned_data_column a on a.aligned_data_id=76
where json_contains(json_extract(f.column_mappings, '$.*'),CAST(a.id as JSON))
I was hoping to be able to just input that query into a stored procedure or some where in code. I am using MySQL and python 3.x