Reputation: 1
I have a situation where the model in the database does not match the model in the API. Specifically, my products' API contains contract price, which is in a separate table, and that table has price specific to each customer/product combination.
Outside of StrongLoop, I would typically solve this with custom/native SQL, but I read in the documentation that such is ill advised in StrongLoop. I have other situations like this where the database model does not efficiently represent the API model, typically due to legacy data definitions in the databases.
Upvotes: 0
Views: 1790
Reputation: 2692
It is possible to run a native SQL query in your case, which would work for your issue. However, not the warning on the documentation page for the Native SQL docs here
This feature has not been fully tested and is not officially supported: the API may change in future releases. In general, it is always better to perform database actions through connected models. Directly executing SQL may lead to unexpected results, corrupted data, and other issues.
You can also find an example of a similar situation in a previous question asked here:
Execute raw query on MySQL Loopback Connector
Upvotes: 1