2

Following Loobback Docs: Discovering models from relational databases, Stackoverflow answer: Loopback not discovering models and Loopback datasource juggler API: Datasource I created a discover js script to get models from an oracle database. The problem is that it never managed to read the relations from the tables. I used the methods

  • discoverAndBuildModels - The result object had the properties of the table and an array called relations but that array was empty
  • discoverSchema - I managed to get the actual model JSON file and write it to the appropriate location. As the method is described in the api to not read relations i was not surprised to not find any here
  • discoverSchemas - Includes option to read relations (called relations but also tried it with associations) which gave me a similar result than discoverSchema but the "relations" tag only had an empty json object assigned to it.

I tried all options with a variety of relations and associations settings but none of them gave me anything but an empty object as the "relations" tag.

Am I missing something in the setup?

Community
  • 1
  • 1
MariusR
  • 1,534
  • 2
  • 11
  • 20

1 Answers1

2

Oh boy, we've also had this issue. You just have to make sure that your user has the appropriated rights. Choose a privileged user (maybe admin?) to gather the data and it should work.

Check out this question for reference: How to query the permissions on an Oracle directory?

Community
  • 1
  • 1
OddDev
  • 3,644
  • 5
  • 30
  • 53
  • 1
    Thank you so much. Like you said i tried to discover the Models using an admin user just to make sure and voila... it got the relations perfectly. Not sure what permission was missing exactly as the user i tried it with had basic Select, Update,Delete, Insert rights but using your link i'll probably find out. Nevertheless it's working now so that's a good start :) – MariusR Jan 23 '17 at 15:43
  • @MariusR I'm in the database development industry since 45 years now. I've seen it all. – OddDev Jan 23 '17 at 15:57