MDM

On Demand Tables

Function: on_demand_tables Type: API Endpoint (POST)

Purpose: This endpoint facilitates the creation and management of tables in the customer database. It allows for the creation, alteration, and deletion of columns within a custom table based on the provided request data.

URL: POST /api/mdm/on_demand_tables

Request Parameters:

  • request (Request): The request object.
  • table_request (TableCreateRequest): An object containing details about the table and columns to be managed.
  • Customer_Key (Header, required): A base64 encoded string containing lscode and firmcode.
  • current_user (str): The current user performing the operation, obtained via dependency injection.

Process:

  1. Decodes the Customer_Key to extract lscode and firmcode.
  2. Checks if the table exists in the metadata (LS_Custom_Tables). If not, it inserts a new entry.
  3. Iterates over the columns in table_request to perform create, alter, or drop operations:
    • Creates a new column if it doesn't exist.
    • Alters an existing column's details.
    • Drops a column if specified.
  4. Constructs and executes a SQL query to create the actual database table based on the processed metadata.
  5. Commits the transaction and returns a response detailing the status of the operations.

Response:

  • A JSON object containing a status message and details of each column operation performed.
  • Indicates success or failure for each step, including any errors encountered.

Exceptions:

  • Handles exceptions related to database operations and invalid customer key formats, providing appropriate error messages.
post/api/mdm/on_demand_tables

Headers

Customer-Keystring required

Request body

tableNamestring required
deleteOptionstring required
errorOptionstring
descriptionstring nullable

Response

Successful Response

{"stackTrail":"paths:/api/mdm/on_demand_tables:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}

Changes

No recorded changes to this endpoint across all 1 revision of this API.