Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex Query
  • Getting started
  • Concepts
  • Step-by-step instructions
  • Data sources and targets
  • Use cases
    • Analyzing Cloud Logging logs
    • Analyzing CDC Debezium streams
    • Viewing Yandex DataLens reports based on data from Yandex Object Storage
    • Analyzing audit logs Yandex Audit Trails
    • Analyzing files with Billing details
  • Working with YQL
  • HTTP API
  • Access management
  • Pricing policy
  1. Use cases
  2. Viewing Yandex DataLens reports based on data from Yandex Object Storage

Visualizing data from Yandex Object Storage on Yandex DataLens dashboards

Written by
Yandex Cloud
  • Setup
    • Creating a data connection in Yandex Query
    • Creating a data source in Yandex DataLens
    • Creating a dataset
  • Charts with data

Yandex DataLens is a data visualization and analysis service. Yandex Query and Yandex DataLens integration lets you visualize data stored in Yandex Object Storage. Yandex DataLens generates a YQL query, Yandex Query runs the query and returns its execution results, while Yandex DataLens visualizes these results.

Below is the architecture of the solution with Cloud Logging.
data-lens-architecture

In the given example, we'll show the cost of New York City yellow taxi trips on the map, depending on the passenger drop-off area, with the driver tip amount highlighted. The data was previously uploaded to Yandex Object Storage and stored in a public bucket named yq-sample-data, in the nyc_taxi_csv folder.

Note

Yandex Cloud provides the New York City taxi trips dataset as is. Yandex Cloud makes no representations, express or implied, warranties, or conditions pertaining to your use of the specified dataset. To the extent allowed by your local laws, Yandex Cloud shall not be liable for any loss or damage, including direct, consequential, special, indirect, incidental, or exemplary, resulting from your use of the dataset.

NYC Taxi and Limousine Commission (TLC):

The data was collected and provided to the NYC Taxi and Limousine Commission (TLC) by technology providers authorized under the Taxicab & Livery Passenger Enhancement Programs (TPEP/LPEP). The taxi trip data is not generated by the TLC, and the TLC makes no representations whatsoever about the accuracy of this data.

Take a look at the Dataset source and its Use Policy.

Setup

Setup steps:

  1. In Yandex Query, create a connection to data stored in Yandex Object Storage.
  2. In Yandex Query, write a query that will generate a data structure.
  3. Create a data source in Yandex DataLens.
  4. In Yandex DataLens, create a dataset.
  5. Create a chart in Yandex DataLens for data visualization.

Creating a data connection in Yandex Query

To get started, create a connection to Yandex Object Storage:

  1. Go to the Yandex Query interface, the Tutorial section, select Batch mode, and click Create infrastructure for training.
  2. In the Create connection window that opens, all the necessary field values are preset, so just click Create to create a connection.
  3. In the Create binding window that opens, all the necessary field values are preset, so just click Create to create a data binding.

Creating a data source in Yandex DataLens

To create a connection, you'll need a service account with the editor role.

To create a Yandex Query connection:

  1. Go to the connections page.

  2. Click Create connection.

  3. Select the Yandex Query connection.

  4. Select the folder to create a Yandex Query connection in.

  5. Specify the connection parameters:

    • Connection name. Name it yellow-taxi.

    • Cloud and folder. Select the folder where your service account will be located.

    • **Service account **. Select an existing service account or create a new one.

    • SQL query access level. Enables you to use an ad-hoc SQL query to generate a dataset.

  6. Click Create in the lower-left corner. The connection appears in the list.

Note

You can check the host connection before creating it. To do this, click Check connection.

Creating a dataset

  1. On the Yandex DataLens homepage, click Create dataset.

  2. On the left side of the screen, click Add.

  3. Select the yellow-taxi connection you created in the previous step.

  4. In the connection properties, go to the SQL tab and paste the query text into the Subquery field:

    SELECT
        *
    FROM
        bindings.`tutorial-analytics`
    
  5. Click Create. The dataset appears in the list.

  6. If everything is set up correctly, the Preview field will contain data like
    yellow-taxi-data.

  7. Create a calculated field:

    1. Go to the Fields tab.
    2. Click Add field.
    3. In the Field name field, specify dropoff_point.
    4. In the Formula field, enter:
      GEOPOINT(ROUND([dropoff_latitude],1),ROUND([dropoff_longitude],1))
      
    5. Click Save.
    6. The Preview section will contain a new field named dropoff_point with data like [40.7,-74].
  8. Click Save in the top right-hand corner to save the dataset.

Charts with data

To create a chart:

  1. Go to the Charts section in the Yandex DataLens interface.
  2. Click Create chart and select Chart.
  3. Select the yellow-taxi dataset.
  4. Select the Map chart type.
  5. Drag the dropoff_point dimension into the Points field.
  6. Drag the fare_amount dimension into the Points size field.
  7. Drag the tip_amount dimension into the Color field.

The result of running the query is a map showing the distribution of trip fares by region and with the driver tip amount highlighted.

datalens-map

Was the article helpful?

Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
In this article:
  • Setup
  • Creating a data connection in Yandex Query
  • Creating a data source in Yandex DataLens
  • Creating a dataset
  • Charts with data