Discovering models from relational databases
You can use API Designer to create models from existing database tables. This process is called discovery and is supported by data source connectors for: MySQL, Oracle, PostgreSQL, and SQL Server.
Before you begin
Before you begin, you must install the developer toolkit on your local machine. For details, see Installing the toolkit.
You must also do the following:
About this task
API Designer can create models based on an existing database schema. Doing this will create a model for each table, and a property in the model for each column in the table.
The following data source connectors support this feature:
- MySQL
- Oracle
- PostgreSQL
- SQL Server
For more information on how model discovery works programmatically and the LoopBack discovery API, see Discovering models from relational databases.
Procedure
- Click .
- If the data source is one of the supported types listed above, the Discover Models option will be available. Click Discover Models. Alternatively, click the data source from which you want to discover models, and in the data source details page, click Discover Models .
- The Discover Models page opens. It lists all the tables in the database to which the data source is connected, and the associated schema for each table.
- Select the check box for each table for which you want to create models. When you select a table, the Select Properties dialog appears, showing the name and type of each property to be created, and whether the property is required and an ID property. By default, each model will be created with a property for each column in the table, so all the properties are selected.
- In the Select Properties dialog, deselect any properties you don't want to create, and click Select.
- Follow step 5 for each model you want to create.
- Click Generate.