Your guide to crafting your very first Outerbase Command. Let's dive in!
To get started with Outerbase Commands, ensure you have a database set up with demo data. If you don't have one, you can follow the provided schema to populate an SQLite database.
Creating a Command
Follow these steps to create a new Outerbase Command:
-
Connect or Create a Database: You can either connect to your existing MySQL or Postgres database or create a new SQLite database directly within Outerbase.
-
Populate Data: If you're using a new database, make sure to populate it with relevant tables and data. You can use the sample dataset provided.
-
Create a Command: Click the "+" button in the top navigation and select "Create Command." Provide a name, path, and choose the desired HTTP request type.
-
Add Inputs: In the first step of the command creation process, click the "+ Input" button. Specify a key and value for the input. This step is useful when you're populating rows in a database.
-
Add Steps: Depending on your task and comfort level, you can add different types of steps: Python, JavaScript, or SQL.
-
For Python:
def userCode(): # Your code here
-
For JavaScript:
function userCode() { // Your code here }
-
For SQL:
SELECT * FROM table_1 LIMIT 10;
-
-
Chain Steps (Optional): You can combine JavaScript, Python, and SQL steps to create more complex commands. For example, you can use JavaScript to validate input and SQL to perform database operations.
-
Build the Command: Click the "Run All" button on the first function to initiate the Deploy phase. This might take a minute or more.
-
Run the Command: Click the "•••" button next to the "Run All" button. Copy the cURL command provided. Paste this command into your terminal, ensuring that you replace placeholders with the correct inputs. Running the cURL command will execute your Outerbase Command.
By following these steps, you can effectively utilize Outerbase Commands to streamline and automate tasks within your database operations.