Gloop Cassandra services
Creating a Gloop Cassandra service
To create a Gloop Cassandra service, follow the steps below:
- Launch the Gloop Cassandra service wizard by right-clicking on the target package's
codedirectory (or any of the directories underneath it) where you'd like to store the Gloop Cassandra service, and then select New > Gloop Cassandra Service.
In the wizard, specify the following details:
- Location - where the Gloop Cassandra service will reside; its default value will be the folder where you started the wizard from
- Name - the name of the Gloop Cassandra service
- Connection Name - the name of the database that the service will connect to while developing the service, and by default when executing it
- Query Type - the type of Cassandra statement the service will perform
- Keyspace - the keyspace that the service will use by default
Launch the wizard using keyboard shortcuts only
In Martini, you can open the Gloop Cassandra service wizard by pressing (or in Martini Online)
cql in the dialog's search box. After that, press and the wizard will appear.
Editing Gloop Cassandra services
After creating the Gloop Cassandra service, the service will automatically open, and you will be shown the Gloop Cassandra service editor.
Here's a breakdown of its primary components:
Connection Name drop-down
The name of the database connection Martini will connect to when being executed. By clicking on the drop-down list, you will be able to choose the database you want to execute queries against. Only registered and started database connections will be selectable. You can change the database connection at runtime by setting the
$martiniConnectionPoolinput property to the name of another database connection.
Cassandra Service Type drop-down
The specific type of operation that the service will execute. Currently, these are the supported types:
Type Description Select Single Used to get the first row of the result set from a
Select Multi Returns an input cursor representing the result set rows from a
Insert Used to insert one row into a table. Insert Batch Used to insert multiple rows into a table. These types of services return an output cursor. Update Used to update a single row. Update Batch Used to update multiple rows in a table. These types of services return an output cursor. Delete Used to delete a single row. Delete Batch Used to delete multiple rows from a table. These types of services return an output cursor.
The default keyspace to be used by this Gloop Cassandra service at runtime.
Show System checkbox
This is to choose whether to show Cassandra system keyspaces in the Database Tree.
Displays the target database's keyspaces, tables, columns, and their types. You can use this to navigate around the database.
CQL Statement text area
The CQL statement based on the Service Type selected. You can edit the service's CQL directly using this component. You can also press whilst editing to bring up the content assist menu.
Testing and previewing CQL queries
If you aren't sure exactly what CQL you need, you can use the Database perspective in Martini Desktop to test your queries. Alternatively, you can right click on a Gloop Cassandra service in the Navigator, and choose Export > CQL Query.
Inputs and outputs
Like regular Gloop services, Gloop Cassandra services have inputs and outputs, too. As the CQL statement changes, the Gloop Cassandra service's inputs and outputs will change as well.
If the CQL statement is incorrect or the output model could not be generated, then a warning will appear underneath the CQL editor. When you hover your mouse pointer over the warning, a tooltip will show up which will provide you with more information on what is wrong with the statement.
Gloop Cassandra services also have special input properties you can set:
||Input||All operations||The database connection name. If this isn't specified, the default database configured in the editor will be used.|
||Input||All operations||The keyspace name. If this isn't specified, the default keyspace configured in the editor will be used.|
||Input||All operations||The consistency level to be used for this service. If this isn't specified, the default consistency level configured in the database will be used.|
||Input||All operations||The serial consistency level to be used for this service. If this isn't specified, the default consistency level configured in the database will be used.|
||Input||All operations||The idempotence to be used for this service. If this isn't specified, the default consistency level configured in the database will be used.|
Parameterized CQL queries are also supported in Gloop. Parameters allow for flexible
CQL commands - arguments don't need to be hard-coded in the CQL statement. You can specify their values by setting
the parameters' name with a
: character prefix, as shown below:
1 2 3 4 5 6
SELECT * FROM catfood where item_id = :itemId
As you modify the CQL and add bound parameters, the Input/Output view will change as shown below:
Create models from a table
If you want to have a Gloop model that represents a Cassandra table, you can right click on a table in the Database tree, then select Export to Gloop Model.
You can also use Martini to help write the CQL statements for you. Right click on the table or columns you would like to include in the statement and choose the type of CQL statement you would like to execute from the appearing context menu. The items in the context menu will depend on the selected value for the Type dropdown. In the example below, Select was used for Type, hence selectable statements are SELECT statements only.
WHERE clause limitations
Cassandra has limitations with the
WHERE clause. Martini will only add supported columns
Generate statements by dragging and dropping table or column nodes to the editor
You can drag and drop tables or columns displayed on the Database node in the Navigator view to the editor. Doing this will prompt Martini to generate a CQL statement based on the selected statement type and provided tables or columns.