Polymorphic Joins on Rails

Active Record is a key part of the Model View Controller (MVC) architecture that Ruby on Rails builds itself around. Specifically, Active Record represents the model portion, and allows backends to…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Task in Airplane

Airplane: A platform for engineers to quickly build high-quality internal tools.

Tasks are server-side operations that you can build from REST APIs, SQL queries, custom code, and more.

Making applications (“tasks”) that you and your teams may utilize using scripts, code snippets, etc. using Airplane is extremely simple.

What is Airplane?
The airplane is a developer platform for internal tools. It enables customers to build better software.

If your SQL query is straightforward, a SQL task can help you get going right away. You may build tasks in languages like TypeScript, JavaScript, or Python if the logic is more complex or there are external dependencies, etc.

Let’s assume we have a database and we want to create or see its proper view or perform some actions in it. In the Airplane, you can do it with very quick steps.

In the Airplane, you can perform or schedule tasks in both offline and online databases. You can also perform the task with TypeScript, JavaScript, or Python on your local machine when you are ready to deploy it, you can do it with easy commands.

Today we will see how to connect MySQL live (Server) database with the airplane and How to create and execute tasks on it.

airplane.dev (Index Page)

After clicking on signup you can create your account with Gmail or you can directly create your account by manually entering your email.

Here you need to create a team by entering your team name, team slug, and allowed email domains (if any) to move further.

After creating your team you will be moved to the learning page. Where you can know about the platform and what all the things you can do, and how to perform the things.

In the left menu, you can see multiple options like Library, Inbox, Schedules, Activity, Deployment, Settings, Templates, etc.

When you click on the plus icon in the library button, The popup screen will open and you can find the options that can help you to build internal tools.

Task: We have discussed this earlier.

Views: Airplane Views is a React-based platform for rapidly building full-featured internal UIs. With the use of Airplane’s component library, you can create high-quality admin panels and internal dashboards.

Runbook:
Runbooks are a set of standardized written procedures for completing repetitive information technology (IT) processes within a company.

They are part of IT Infrastructure Library (ITIL) protocols, which incorporate information from IT processes, such as knowledge management and problem management.

What is the purpose of a runbook?
Runbooks provide IT teams with contextual documents that increase consistency and efficiency through standardization. They act as a walkthrough or step-by-step guide for both new and experienced IT professionals within the team.

Today we will explore the Task feature,

From the below popup screen when you click on the task, you will be moved to the task page where you can see what all the things you can do and all the platforms you can connect and work with.

You can perform the task by 2 methods:

Today we will explore the GUI option.

In the GUI option, you can get many options like:

Let’s see how to connect the MySQL database with Airplane and how to create a task with it and we will also perform some queries in Airplane itself and we will see the output.

First of all, we need to add MySQL to the resources of the Airplane. For that, we need to go to the settings.

Here on the settings page, you can see the resources page right side. When you click on the resources you can see the sample database there and you will be able to see all your resources here only after adding them. And you can also see New Resource in the left corner.

Resources Section

When you click on New Resources you will be able to see the side screen which contains all the resources like databases, APIs, and messaging apps that you can connect with the Airplane.

So Let’s Connect the MySQL database today.

For that, you need to click on the MySQL button which you can see on the New Resources page. After clicking on the button you will be able to see this page. (As Below)

Here you need to enter some fields like Name of the database , Host , Port , Database , Username , Password .

Use the toggle to turn on the SSL. Also if you have a database on the private network, Use enable SSH tunnel toggle.

Here you also have the option to give access to the team members. You can either give full access to the team members or you can give Explicit permissions which only allow access to the specified users or groups.

If using Airplane-hosted agents, ensure your database has whitelisted the following IPs:

After entering all the information you can test the connection for confirmation before adding it to the resources.

It will verify the configurations and if you have entered all the correct values, you can see the above message for test success. Then you can just click on create and your MySQL will get successfully added to the resources.

Here you can see the confirmation message that you’ve created a new resource! Here I have a database named Plantation.

Now we will perform/Create a task on the added database. You can directly create a task by clicking on create the task on the alert box or you can go to the library and you can find the task option there as well.

If you create a task from here itself it will automatically redirect you to create an SQL task.

Here you have to give a task name and the description also you can add parameters as per your need. Parameters define what users are asked to input into this task. You can also add this task to the specified folder to manage your things in an arranged way.

Here we will give our task name as a plantation. Then we will just give a description like: Let’s create a plantation task (You can give a description as your project need). Then we will click on continue.

After clicking on continue you can see this screen:

Here you can see the database already selected by default. You can change it as per your task. Also, you can notice that Airplane fetched schema from the MySQL database.

In the plantation app, there are tables mentioned in the schema. We will execute some tasks on the demand table.

We will first create the task, from where we can see the data available there in the demand table.

We have given the task name as ShowDemand, and the Description we gave displays the demand data. Here we don’t need any specific parameter to execute the query. So we will just move to the next part by clicking on the continue button.

On the next page, we will select database: Plantation, and then we will add SQL query : SELECT * FROM demand; this is just a simple query that will show all the data available in the demand table.

After that when we press on the continue we can set the permission that who can execute this task.

After that, we will create the task and we can see a page like this:

Here we can see the execute task button. and the New schedule button. After clicking on the execute task we will be able to see the page like this:

Here you can see data in the well-arranged table. Where you can also search for any specific data to check.

Here in this page, you can see that the task has been executed successfully. And we can also see logs, output JSON, and some advanced information.

We can also schedule tasks for executing any task at some specific time by clicking on the New Schedule button.

Let’s see how we can specific data from the demand table by creating a task in Airplane. For that, we will create another task from the library. We will again select the SQL task there.

Here we have given the task name as delete-demand-item here we will add one parameter which can help us to delete the specific item from the table. We will delete the data according to the quantity. So in the parameters, we will give a name as deletedemanditem and type as a Number because the quantity will be in the form of the number.

After that, we will add a query on the next page.

On this page we have added the delete query: DELETE FROM demand where qty = :qtynumber; here if you noticed we have added :qtynumber this is basically a key that will help to reference the argument. we have added a Query argument here. Parameters can be used as the value of a query arg as {{params.slug}}(here {{params.deletedemanditem}}). After this, we can give permissions as we have discussed in the select task. So we will create this task. and we will be able to see output like this:

Here you can see that we have the option to enter the quantity. As we have created a parameter and added the key in the query.

We have one data that has quantity = 3.

Let’s give input as 3 and we will see whether the entry is getting deleted or not.

In the logs you can see more information about the execution of the task:

Conclusion:

As we know that for performing some tasks like this we need to develop specific things like dashboards and admin pages and etc. But as we have seen today how easy the thing is to execute with the Airplane Task. We can save lots of time and we can utilize that time for other things. It is as simple as we are creating the database by writing different-different queries.

In this, you got some information about Airplane and some basic things like what is task and how to connect MySQL database with the Airplane and How to create and execute various tasks.

I will come back with some advanced tasks and other features provided by the Airplane in the near future. Stay tuned!

Thank you for your valuable time. If you liked this, please give a clap. It will motivate me to write more. If you have any suggestions, please write them in the respond section.

Add a comment

Related posts:

Juniper Publishers Open access journal of Ecology

Landscape-scale conservation planning offers a way out to the ecosystems degradation while ensuring the participation of different levels of governance and the community in this process. The…

Insurance 101

It was a couple of years ago, during my MBA curriculum that I came across this chart. And for obvious reasons, this didn’t catch my attention and came across as just being too obvious, just as…

Introduction

I have been wanting to start a blog for awhile now. I feel I have a lot to share. I began writing in my journal daily last year, and it has saved me from the non stop stream of thinking that is…