Database Administration
Use the topics in this article to administer your database in API Creator.
lac52
Use the topics in this article to administer your database in API Creator.
In this article:
Configure your Data Source to Access your Database Administration Web Tool
You manage your schema using your existing tools and procedures. You can configure your data source to access your database administration web tool using the fields on the Connection page.
With your API open, in the Create section, click
Data Sources
. The Connection page displays by default.For more information about how to use set up and use managed databases, see Database Creation.
Reload Schemas
When you first create an active data source connection (the
Active
checkbox is selected on the Connection tab), Layer7 Live API Creator
reads the database metadata (your data source connections, resource definitions, logic, and security settings) and caches it as part of your API definition in the admin repository. As the schema evolves and you change it, you must reload it. When you reload the schema, Layer7 Live API Creator
throws away the API Server cache, rereads the database metadata, and caches it in your API definition in the admin repository.The time it takes
Layer7 Live API Creator
to rescan the database metadata and update the cache depends on the size of the database and the latency to the database server.Follow these steps:
- With your API open, in the Create section, clickSchema.The Tables tab appears by default.
- ClickReload Schema.
The schema is reloaded.
Reload the Browser from the Cache
You can refresh the local copy of schema from
Layer7 Live API Creator
. API Creator reloads the browser from the cache (possibly update by other users) by polling the @tables
system REST endpoint for your API.For more information about the
@tables
system REST endpoint, see System REST Endpoints.From the Tables tab, click the
Synch
icon.The browser is reloaded from the cache.
Export Schemas
You can export a schema from the current API data source that is listed. Exporting your schema exports the schema and the database relationships that you have defined with foreign keys and primary keys.
Your exported schema does not include the virtual relationships that you have defined for your API. You can export these virtual relationships by exporting your API. For more information about how to export APIs, see Import and Export APIs.
Follow these steps:
- From the Tables tab, clickExport Schema.The Export Schema window opens.
- Select the data source that you want to export from theData sourcedrop-down, and then clickExport.
Your schema is exported as a JSON file.
Import Schemas
Schemas are JSON files in a specific format that describes the tables, columns, keys, and relationships. When you import a schema,
Layer7 Live API Creator
creates a complete persistent store using the data model. It uses managed data REST endpoints (@schema
, @table
, @column
, @databases
, and @relationships
) to retrieve this information.Prerequisite:
The schema must be marked as editable (the Schema is editable
checkbox is selected on the Connection tab).Follow these steps:
- From the Tables tab, clickImport Schema.The Import Schema window opens.
- Select the data source that you want to import the schema to from theData sourcedrop-down, and then clickSelect File to upload.
- Go to the JSON file containing the schema that you want to import, and then clickOpen.
- (If you are importing a schema from a different SQL database) Complete the following:
- ClickAdvanced Features.
- Select one or more of the following options:Skip Table Creation PhaseSelect this checkbox to skip the table-creation phase. When this checkbox is selected,Layer7 Live API Creatorimports the data without relationship-enforcement constraints.Default:ClearedSkip Relationship Creation PhaseSelect this checkbox to skip the relationship-creation phase.You can haveLayer7 Live API Creatorenforce relationships by selecting this checkboxafteryou have imported the schema.Default:ClearedIgnore DB Column TypeSelect this checkbox if you are moving from one database vendor to another.Layer7 Live API Creatoruses thegeneric_typeand subtype for each column instead of thedb_column_type, for example"db_column_type": "DECIMAL(19,4)".Layer7 Live API Creatorattempts to create a data type similar to thedb_column_type.You can only import schemas from the same database data type.Layer7 Live API Creatorguesses the appropriate type if possible.Default:ClearedIgnore Primary Key Name(Optional) Select this checkbox if you are moving from one database vendor to another and you wantLayer7 Live API Creatorto ignore the exported primary key name and create a new unique name, for example"name": "SQL160918190322411".Default:ClearedIgnore Constraint NameSelect this checkbox to haveLayer7 Live API Creatorignore the exported database constraint name and create a new name.
- ClickImport.
Your schema is imported.
Verify your API after Schema Changes
The JavaScript object model matches your current schema (subject to schema caching). Changes to your schema can make rule-based objects (for example, resources) invalid, due to dangling references.
Follow these steps:
- With your API open, in the Create section, clickData Sources.The Connection page displays by default.
- ClickReload Schema.
- In the Create section, clickAPI Properties.The Details tab appears by default.
- Verify your API by clickingVerify.API Creator identifies and logs issues for those resources that refer to objects that no longer exist (for example, because they were deleted or renamed).
- In the Tools section, clickIssues, and then review the issues.For more information about how to generate a list of API issues and how to review the issues, see Manage API Issues.
- (Optional) Add the virtual relationships that you need for the imported schema.For more information about how to add relationships, see Manage Relationships.
Your API is verified.