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), 
CA 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, 
CA 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 
CA 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:
 
  1. With your API open, in the Create section, click 
    Schema
    .
    The Tables tab appears by default.
  2. Click 
    Reload Schema
    .
The schema is reloaded.
Reload the Browser from the Cache
You can refresh the local copy of schema from 
CA 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:
 
  1. From the Tables tab, click 
    Export Schema
    .
    The Export Schema window opens.
  2. Select the data source that you want to export from the 
    Data source
     drop-down, and then click 
    Export
    .
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, 
CA 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:
 
  1. From the Tables tab, click 
    Import Schema
    .
    The Import Schema window opens.
  2. Select the data source that you want to import the schema to from the 
    Data source
     drop-down, and then click 
    Select File to upload
    .
  3. Go to the JSON file containing the schema that you want to import, and then click 
    Open
    .
  4. (If you are importing a schema from a different SQL database) Complete the following:
    1. Click 
      Advanced Features
      .
    2. Select one or more of the following options:
      Skip Table Creation Phase
       
      Select this checkbox to skip the table-creation phase. When this checkbox is selected, 
      CA Live API Creator
       imports the data without relationship-enforcement constraints.
      Default:
       Cleared
      Skip Relationship Creation Phase
       
      Select this checkbox to skip the relationship-creation phase.
      You can have 
      CA Live API Creator
       enforce relationships by selecting this checkbox 
      after
       you have imported the schema.
      Default:
       Cleared
      Ignore DB Column Type
       
      Select this checkbox if you are moving from one database vendor to another. 
      CA Live API Creator
       uses the 
      generic_type
       and subtype for each column instead of the 
      db_column_type
      , for example 
      "db_column_type": "DECIMAL(19,4)"
      CA Live API Creator
       attempts to create a data type similar to the 
      db_column_type
      .  
       You can only import schemas from the same database data type. 
      CA Live API Creator
       guesses the appropriate type if possible.
      Default:
       Cleared
      Ignore Primary Key Name
       
      (Optional) Select this checkbox if you are moving from one database vendor to another and you want 
      CA Live API Creator
       to ignore the exported primary key name and create a new unique name, for example 
      "name": "SQL160918190322411"
      .
      Default:
       Cleared
      Ignore Constraint Name
       
      Select this checkbox to have 
      CA Live API Creator
       ignore the exported database constraint name and create a new name.
  5. Click 
    Import
    .
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:
 
  1. With your API open, in the Create section, click 
    Data Sources
    .
    The Connection page displays by default.
  2. Click 
    Reload Schema
    .
  3. In the Create section, click 
    API Properties
    .
    The Details tab appears by default.
  4. Verify your API by clicking 
    Verify
    .
    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).
  5. In the Tools section, click 
    Issues
    , 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.
  6. (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.