Ask AI
Skip to main content

Insert into ext. database

Function: Insert into ext. database

This action allows you to add a new record (a row of data) into a table within an external database. It's perfect for when you need to store information generated by your application directly into a database that's not part of your platform.

Input

  • Database connection: This is a collection of settings needed to connect to your external database.
    • Type: Choose the type of database you are connecting to. (A selection from a dropdown: MSSQL, MYSQL)
    • Server: The address or hostname of your database server. (A piece of text)
    • Database: The name of the specific database you want to connect to. (A piece of text)
    • User: The username for accessing the database. (A piece of text)
    • Password: The password for the specified user. (Password)
    • Port: The port number used for the database connection. (An integer)
  • Table: The name of the table in your external database where you want to insert the data. (A piece of text)
  • Data format: This defines the expected structure or schema of the data you are inserting. (A database table or data transfer object)
  • Data: The actual information you want to insert. This should be provided as a list of key-value pairs, where each key corresponds to a column name in your database table, and its value is the data you want to store in that column. (A list of key/value pairs combined in an object)

Output

None. This action primarily performs an operation on an external system and does not return any specific data to your application.

Execution Flow

Real-Life Examples

Example 1: Adding a New Customer to a CRM Database

Imagine you have a form on your application where users can sign up. After a user submits the form, you want to add their details to an external Customer Relationship Management (CRM) database.

  • Inputs:
    • Database connection:
      • Type: MYSQL
      • Server: crm.mycompany.com
      • Database: customer_db
      • User: crm_user
      • Password: secure_pass123
      • Port: 3306
    • Table: Customers
    • Data format: (Assumes a Customer data format with fields like FirstName, LastName, Email)
    • Data:
      \{
      "FirstName": "Alice",
      "LastName": "Smith",
      "Email": "[email protected]",
      "SignUpDate": "2023-10-27"
      \}
  • Result: A new record for "Alice Smith" with her email and sign-up date is added to the Customers table in your external CRM database.

Example 2: Logging an Event in an Analytics Database

Your application tracks user activity, and you want to send specific event data to an external analytics database for reporting and analysis.

  • Inputs:
    • Database connection:
      • Type: MSSQL
      • Server: analytics.mycompany.net
      • Database: event_logs
      • User: analytics_writer
      • Password: event_pass456
      • Port: 1433
    • Table: UserEvents
    • Data format: (Assumes an EventLog data format with fields like EventType, UserID, Timestamp, Details)
    • Data:
      \{
      "EventType": "ProductView",
      "UserID": "user_12345",
      "Timestamp": "2023-10-27 14:30:00",
      "Details": "Viewed product ID: P789"
      \}
  • Result: A new entry detailing a "ProductView" event by "user_12345" is added to the UserEvents table in the external analytics database.

Example 3: Adding a New Product to an Inventory System

When a new product is created in your application, you need to ensure it's also registered in an external inventory management system's database.

  • Inputs:
    • Database connection:
      • Type: MYSQL
      • Server: inventory.mycompany.org
      • Database: inventory_db
      • User: inv_admin
      • Password: stock_secure789
      • Port: 3306
    • Table: Products
    • Data format: (Assumes a Product data format with fields like ProductID, ProductName, Price, StockQuantity)
    • Data:
      \{
      "ProductID": "SKU001",
      "ProductName": "Wireless Mouse",
      "Price": 25.99,
      "StockQuantity": 150
      \}
  • Result: A new product record for "Wireless Mouse" with its price and initial stock quantity is added to the Products table in the external inventory database.