I am prototyping a machinelearning model to generate "sorting data" for objects. The objects are stored in a mysql db which are accessed through an SQLAlchemy abstraction layer. Now i would like to filter and sort this data through the data i pull from the second server (where the ML is running).
So far I have managed to filter the data by adding the id's pulled from the ML-server to a IN Filter statement:
.filter(Job.id.in_(list(sum(ai_match, ()))))
whereas ai_match is a tuple of the id's pulled from the ML Server. This works fine but I would like to sort the list by the similarityalso in the ML server. From an SQL perspective this would just be an inner join over the two databases:
`SELECT * FROM jobs
INNER JOIN mlserver.matches ON mlserver.matches.job_id = jobs.id`
however the ML Server is not a SQL Alchemy Object and i do not want to create one (as the project is rather massive and very complex and i don't have the ability to go deep into the whole project structures myself).
Which leads me to the question:
How can I "Inject" data into an existin SQL Alchemy Object so to acheive the desired JOIN on a dictionary which would be of the format [(job_id, similarity),]
Thanks for your help!