Flint provides out-of-the-box or ready to use workflows for DataBase Operations. Here are the details of workflows/Flintbits for DataBase -

Flintbox nameLocationSSH Flintbits
flint-utilhttps://github.com/getflint/flint-util.gitflint-util > db > operation

Available Flintbits

Perform all standard application operations available for DataBase, Some of them are listed below:

DataBase available Flintbits

  • insert.rb
  • update.rb
  • delete.rb
  • select.rb
  • procedure.rb

Insert

To Insert data into the database

Input and output JSON for the Insert query

This section illustrates the Flintbit Input and output for Insert query.

Sample Input JSON for the Insert query
{
    "connector_name":"jdbc",
    "jdbc_url": "jdbc:mysql://localhost:3306/Anurag",
    "user_name":"root",
    "password":"anurag1",
    "driver":"com.mysql.jdbc.Driver",
    "query":"insert into cpuinfo(ip)values('1');"
} 

Flintbit input elements for the Insert query
ParameterDescriptionrequired
connector_nameName of the File Connector to be configured.true
jdbc_url

 To point the database to which you wish to connect.

true
portPort number on which the target server is listening, not required if jdbc_url is givenfalse
databaseName of Database to be in use, not required if jdbc_url is givenfalse
user_nameUsername associated with the database.true
passwordPassword associated with the database.true
db_typeType of Database. Valid types : mysql, postgresql, Microsoft SQL and oracle ,not required if jdbc_url is givenfalse
targetHostname of the database server,not required if jdbc_url is givenfalse
queryQuery to run for Databasetrue
driverName of the driver depending on the type of database specified.                                            example:"com.mysql.jdbc.Driver" for mysqltrue
Sample JSON output for the Insert query
{
  "meta": {
    "job-id": "job-639c216c-6e74-4c67-adbc-9c6fe8132678",
    "exit-code": 0,
    "context": "flint-util:db:operation:insert.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469619333019,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "result": "1"
  }
}

Update

To Update data into the database

Input and output JSON for the Update query

This section illustrates the Flintbit Input and output for Update query.

Sample Input JSON for the Update query
{
    "connector_name":"jdbc",
    "jdbc_url": "jdbc:mysql://localhost:3306/Anurag",
    "user_name":"root",
    "password":"anurag1",
    "driver":"com.mysql.jdbc.Driver",
    "query":"update cpuinfo set ip='21' where ip='1';"
} 

Flintbit input elements for the Update query
ParameterDescriptionrequired
connector_nameName of the File Connector to be configured.true
jdbc_url

 To point the database to which you wish to connect.

true
portPort number on which the target server is listening, not required if jdbc_url is givenfalse
databaseName of Database to be in use, not required if jdbc_url is givenfalse
user_nameUsername associated with the database.true
passwordPassword associated with the database.true
db_typeType of Database. Valid types : mysql, postgresql, Microsoft SQL and oracle, not required if jdbc_url is givenfalse
targetHostname of the database server, not required if jdbc_url is givenfalse
queryQuery to run for Databasetrue
driverName of the driver depending on the type of database specified.                                            example:"com.mysql.jdbc.Driver" for mysqltrue
Sample JSON output for the Update query
{
  "meta": {
    "job-id": "job-e7604bf0-7b85-42f4-a2c4-cfc5a98eb0c6",
    "exit-code": 0,
    "context": "flint-util:db:operation:update.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469622534947,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "result": "1"
  }
}

Delete

To Delete data from the database

Input and output JSON for the Delete query

This section illustrates the Flintbit Input and output for Delete query.

Sample Input JSON for the Delete query
{
    "connector_name":"jdbc",
    "jdbc_url": "jdbc:mysql://localhost:3306/Anurag",
    "user_name":"root",
    "password":"anurag1",
    "driver":"com.mysql.jdbc.Driver",
    "query":"delete from cpuinfo where ip='21';"
} 

Flintbit input elements for the Delete query
ParameterDescriptionrequired
connector_nameName of the File Connector to be configured.true
jdbc_url

 To point the database to which you wish to connect.

true
portPort number on which the target server is listening, not required if jdbc_url is givenfalse
databaseName of Database to be in use, not required if jdbc_url is givenfalse
user_nameUsername associated with the database.true
passwordPassword associated with the database.true
db_typeType of Database. Valid types : mysql, postgresql, Microsoft SQL and oracle, not required if jdbc_url is givenfalse
targetHostname of the database server, not required if jdbc_url is givenfalse
queryQuery to run for Databasetrue
driverName of the driver depending on the type of database specified.                                            example:"com.mysql.jdbc.Driver" for mysqltrue
Sample JSON output for the Delete query
{
  "meta": {
    "job-id": "job-840b7e49-425e-4845-a2a8-24d6d3f303ae",
    "exit-code": 0,
    "context": "flint-util:db:operation:delete.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469622854275,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "result": "1"
  }
}

Select

To retrieve data from the database.

Input and output JSON for the Select query

This section illustrates the Flintbit Input and output for Select query.

Sample Input JSON for the Select query
{
    "connector_name":"jdbc",
    "jdbc_url": "jdbc:mysql://localhost:3306/Anurag",
    "user_name":"root",
    "password":"anurag1",
    "driver":"com.mysql.jdbc.Driver",
    "query":"select * from cpuinfo"
} 

Flintbit input elements for the Select query
ParameterDescriptionrequired
connector_nameName of the File Connector to be configured.true
jdbc_url

 To point the database to which you wish to connect.

true
portPort number on which the target server is listening, not required if jdbc_url is givenfalse
databaseName of Database to be in use, not required if jdbc_url is givenfalse
user_nameUsername associated with the database.true
passwordPassword associated with the database.true
db_typeType of Database. Valid types : mysql, postgresql, Microsoft SQL and oracle, not required if jdbc_url is givenfalse
targetHostname of the database server, not required if jdbc_url is givenfalse
queryQuery to run for Databasetrue
driverName of the driver depending on the type of database specified.                                            example:"com.mysql.jdbc.Driver" for mysqltrue
Sample JSON output for the Select query
{
  "meta": {
    "job-id": "job-1800fb68-71a7-491d-be4f-e09b18a13a01",
    "exit-code": 0,
    "context": "flint-util:db:operation:select.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1469623101890,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "result": "[{\"memory\":\"97.3952\",\"cpu_usage\":\"100\",\"disk_space\":\"7\",\"ip\":\"192.168.2.16\"},{\"memory\":\"97.3362\",\"cpu_usage\":\"24.3\",\"disk_space\":\"14\",\"ip\":\"192.168.2.51\"}]"
  }
}

Procedure

To call stored Procedure

Input and output JSON for the Procedure 

This section illustrates the Flintbit Input and output for Procedure.

Sample Input JSON for the Procedure
{
"connector_name":"jdbc",
"action":"procedure",
"user_name":"root",
"password":"anurag1",
"jdbc_url":"jdbc:mysql://localhost:3306/Anurag",
"driver": "com.mysql.jdbc.Driver",
"query":"call select_tab();"
}
Flintbit input elements for the Procedure
ParameterDescriptionrequired
connector_nameName of the File Connector to be configured.true
jdbc_url

 To point the database to which you wish to connect.

true
portPort number on which the target server is listening, not required if jdbc_url is givenfalse
databaseName of Database to be in use, not required if jdbc_url is givenfalse
user_nameUsername associated with the database.true
passwordPassword associated with the database.true
db_typeType of Database. Valid types : mysql, postgresql, Microsoft SQL and oracle, not required if jdbc_url is givenfalse
targetHostname of the database server, not required if jdbc_url is givenfalse
queryQuery to run for Databasetrue
driverName of the driver depending on the type of database specified.                                            example:"com.mysql.jdbc.Driver" for mysqltrue
Sample JSON output for the Procedure
{
  "meta": {
    "job-id": "job-ce29ce32-8c73-48c2-a848-aaaa95237d1f",
    "exit-code": 0,
    "context": "flint-util:db:operation:procedure.rb",
    "message": "success",
    "timeout": 60000,
    "timestamp": 1470308050147,
    "status": "complete",
    "content-type": "application/json",
    "username": "admin"
  },
  "output": {
    "result": "[{\"name\":\"atharva\",\"id\":\"5\"},{\"name\":\"Abhi\",\"id\":\"2\"},{\"name\":\"shubh\",\"id\":\"3\"}]"
  }
}

On this page: