Stave is a column based repository. Data is stored in columns. Stave offers better data compression, and extremely fast data retrieval.
Each column in Stave has the following characteristics:
Stave is very good for managing stable data, that maybe changes once a day.
You have to enable symbolic links on your system as the resultant table with the appended records is symlinked to the existing original table.
On Unix and Linux, symbolic links are automatically enabled. Perform the following steps to enable symbolic links on Windows.
secpol.msc
using Start or Start → RunCreate symbolic links
item, which represents SeCreateSymbolicLinkPrivilege
.To save data from the Data Designer as a Stave Database:
DataStore
and select Properties
.
Stave
, as shown in Figure 5.18, “Stave Datastore”.
Select the Append to Existing Records
option as shown in Figure 5.19, “Append Records Option - Stave Datastore”.
This causes new records to be appended to
the datastore instead of the datastore being created again.
Datastore
and select Generate
to write the data to the datastore.Binning allows you to create new columns by grouping or deriving data from existing columns.
To use binning, you need to write Scala code.
The following example demonstrates the use of binning to add a column to the Cars
database.
Bin-Sample
.Datasource
and select cars.ds
as the input.
Datastore
and select the type as Stave
. Enter the stave folder name as Cars
.
Datastore
and select Generate
. This writes the data to the Stave database.data/stave/eno/Cars
folder inside your Ambience installation folder.bin
and place the following Scala code in a file called GearBoxBin.scala
, inside the bin
folder.
import com.elixirtech.stave.ColumnMetadata import com.elixirtech.stave.transform.BinLogic object GearBoxBin extends BinLogic { val inColumns = List("trade_in_vehicle_drive_train","new_vehicle_drive_train") def outColumn(in : ColumnMetadata) : ColumnMetadata = { in.copy(name=in.name+"_gearbox") } def fn(obj : Object) : Object = { try { val s = obj.asInstanceOf[String] if (s.contains("Auto")) "Automatic" else if (s.contains("Manual")) "Manual" else "Unknown" } catch { case ex : Exception => "Error" } } } GearBoxBin
This program creates a new column called trade_in_vehicle_drive_train_gearbox
and marks the gear selection as either Auto or Manual, based on the input from the trade_in_vehicle_drive_train
column. This shows you whether the traded-in vehicle had automatic or manual gears.
Similarly, the program creates another new column called new_vehicle_drive_train_gearbox
and marks the gear selection as either Auto or Manual, based on the input from the new_vehicle_drive_train
column. This shows you whether the newly purchased vehicle has automatic or manual gears.
Datastore
and select Generate
. Ambience processes the Scala
file and writes the the data to the Stave database.Add - Universe
.
Stave
and enter a name for the Universe.
Cars
table for the Universe.
trade_in_vehicle_drive_train_gearbox
and new_vehicle_drive_train
) are also displayed in the mapping table.
Ambience version 4.2 onward supports the Multi-Stave feature.
Stave stores each data set in a separate folder. With the Stave Universe, you can map one set of columns into multiple logical tables. For example, Courses
might contain the courses for which a student is registered while Persona
might contain all other details of the student.
Therefore, from Ad-Hoc Report and Dashboard, the one large Stave table looks like multiple Universe tables.
To add additional information, you need to add it as other columns to the table using Binning and Derivatives based on existing columns.
What if you have data in another Stave folder that you want to display on your Report or Dashboard? Ambience 4.2 onward allows you to add multiple Stave folders in a single Universe.
Just select the folders you want to add when creating the Stave Universe.
After you create the Universe, do the mapping as documented in the section called “Mapping Stave Columns to Logical Tables”.
You cannot create a logical table that spans across two Stave folders. Each logical table must get all columns from a single Stave folder.
Ambience version 4.2 onward allows you to join across Stave folders.
For example, suppose you have a State
table with two columns: State Name and State Region.
You also have a Weather
table with three columns: State Name, Min Temp and Max Temp.
Since there is a common field in these tables, you can join them together.
Select the joinable column from each table - in our example, it is State Name
in each table. Then add a new column attribute of type JoinableId
from the Column Attributes
drop down. Enter any meaningful name as the ID.
When creating an Ad-Hoc Report or Dashboard, choose fields from both folders - State
and Weather
, in our example. The Universe will scan all used tables for join-able attributes and when it finds a match, will allow them to join.
Double click a Stave Universe from the folder tree to open it in the Universe Designer.
The Universe Designer displays as shown in Figure 5.29, “Universe Designer for a Stave Universe”:
Before the Stave columns can be used, you need to map them to a logical table.
Click the Mapping
tab. For each row, enter a name for the Universe table
and a name for the column as shown in Figure 5.30, “Table Mapping for a Stave Universe”.
Observe how Stave automatically names the Date columns once you enter a name for the Universe
table for the column marked Date
. This occurs since Date in Stave is internally represented as multiple rows, one each for
Day, Day of Week, Month, Quarter and Year.
Similarly, Stave automatically names the Time columns once you enter a name for the Universe
table for the column marked Time
. This occurs since Time in Stave is internally represented as multiple rows, one each for
Hour and Minute.
Once you finish Mapping, click the Tables
tab.You will see the mapped Universe table as shown in Figure 5.31, “Mapped Table for a Stave Universe”.
Click the table and proceed with the operations as specified in the section called “Repository Universe”.