Save Views or Tabular Views

  • Capella Columnar
  • how-to
    +
    You can save the results of queries that use selection syntax in a view or tabular view.

    Prerequisites

    To use the workbench for Capella Columnar:

    Save Results as a View

    To save results in a view, select Save Query as View. After you supply a name for the view, it appears in the explorer under a Views heading.

    Example

    To access the travel-sample data used in this example from Capella Columnar, see Import the travel-sample Collections.

    For example, you enter the following query:

      SELECT * FROM travel-sample.inventory.airline
      WHERE country = "FRANCE";

    You then select Save as View and save the results in a FrenchAirlines view.

    You can then query your view:

      SELECT * FROM travel-sample.inventory.FrenchAirlines;

    The results show that a new top-level "FrenchAirlines" object contains the selected "airline" objects.

    Save Results as a Tabular View

    To make data in JSON format usable by relational tools such as Tableau and Power BI, you save query results in a tabular view. Tabular views are also referred to as tabular analytics views (TAV).

    Capella Columnar uses a normalization process to convert nested objects into tabular form. When you create a tabular view, you:

    • Flatten any objects that themselves contain a nested object.

    • Select the keys to include as columns in the table.

    • Specify the data types for the columns.

    • Identify the field or fields that make up the primary key.

    • Specify the name of the foreign view for any fields that are foreign keys.

    Example

    To access the travel-sample data used in this example from Capella Columnar, see Import the travel-sample Collections.

    For example, you enter the following query:

      SELECT * FROM travel-sample.inventory.airline LIMIT 25;

    After you select Save as View, you click Annotate for Tabular View.

    Initially, your query results in the error "Tabular views can’t work with object or array fields. No view-usable fields found." Capella Columnar suggests query syntax to flatten the "airline" object.

    You re-try the query with the suggested syntax:

      SELECT airline.* FROM travel-sample.inventory.airline LIMIT 25;

    Now you specify the primary key, select which keys to include as columns, and can make any adjustments to the data types Capella Columnar supplies.

    For more information about the normalization process, see Tabular Views. For more information about connecting to data visualization tools, see Use Business Intelligence Tools.