Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Query
  • Yandex Query shutdown
    • All tutorials
    • Migrating from Yandex Query
    • Processing Cloud Logging logs
    • Processing Debezium CDC streams
    • Visualizing Object Storage data in DataLens
    • Processing Audit Trails events
    • Processing usage detail files in Yandex Cloud Billing
    • Analyzing data with Jupyter
    • Task automation via Managed Service for Apache Airflow™
    • Analyzing data with Query
    • Working with data in Object Storage
    • Working with data in Managed Service for ClickHouse®
    • Working with data in Managed Service for PostgreSQL
    • Federated data queries
    • Searching for Yandex Cloud events in Query
  • Access management
  • Pricing policy
  • Integrations
  • Audit Trails events
  • FAQ

In this article:

  • How to choose your target environment
  • Direct reading from Object Storage
  • Getting started
  • Read the data
  • Yandex Managed Service for YDB
  • Entity mapping
  • Getting started
  • Federated queries: reading files from Object Storage
  • Column-oriented tables: loading data into the database
  • Database connections
  • Check the result
  • If something went wrong
  1. Tutorials
  2. Migrating from Yandex Query

Migrating from Yandex Query

Written by
Yandex Cloud
Updated at October 13, 2026
View in Markdown
  • How to choose your target environment
  • Direct reading from Object Storage
    • Getting started
    • Read the data
  • Yandex Managed Service for YDB
    • Entity mapping
    • Getting started
    • Federated queries: reading files from Object Storage
    • Column-oriented tables: loading data into the database
    • Database connections
  • Check the result
  • If something went wrong

Warning

Starting October 13, 2026, Yandex Query will be unavailable to new users.

Current users will be able to create and modify entities until November 10, 2026. Afterwards, Yandex Query will go read-only and cease to operate on December 14, 2026. For more information on how it will be handled, see Yandex Query shutdown.

Once Yandex Query is discontinued, you will be able to work with your data in one of the following ways:

  • Direct reading from Object Storage. Read data from the bucket using S3-compatible utilities, libraries, or your application.
  • Yandex Managed Service for YDB. Run federated queries against files in Object Storage using external data sources and external tables. You can write the results to the output bucket.

Warning

Connections, data bindings, and Yandex Query queries are not automatically migrated. You will need to recreate them by following the steps below. The Yandex Query discontinuation does not affect the data in the Object Storage buckets.

This guide describes the migration of analytical queries. There is no direct equivalent in Yandex Cloud for Yandex Query streaming queries.

How to choose your target environmentHow to choose your target environment

This section provides a brief comparison of methods for handling data once Yandex Query is no longer available.

Scenario

How you use Yandex Query

Direct reading from Object Storage

You read files, such as usage details in CSV format, and process them within your application.

Federated queries in Yandex Managed Service for YDB

You regularly run analytical queries against files in a bucket, store query text in your code, or use data bindings.

Column-oriented tables in Yandex Managed Service for YDB

You are building frequently updated dashboards or repeatedly reading the same data.

Choose direct reading from Object Storage if:

  • Data processing is already implemented in your application.
  • Queries are simple and do not require SQL.
  • You read files rarely or only once.

Choose federated queries in Yandex Managed Service for YDB if:

  • Data must remain in the bucket.
  • You want to retain SQL queries and the familiar model of working with external data.
  • Same files are not read repeatedly.

Choose column-oriented tables in Yandex Managed Service for YDB if:

  • Same data is used in recurring queries or dashboards.
  • Speed of repetitive analytical queries is important.
  • You are ready to load data from the bucket into the database.

Tip

If you used Yandex Query for SQL queries against files in Object Storage, start with federated queries in Yandex Managed Service for YDB. This option requires fewer changes to queries and does not require moving the source data out of the bucket.

The pricing structure is different for Yandex Query and Yandex Managed Service for YDB. In Yandex Query, you pay for the amount of data read by queries. When reading directly from Object Storage, operations and outbound traffic are charged. In Yandex Managed Service for YDB, dedicated computing resources and database storage are charged independently of the number of requests. For more details on resource costs, see the Object Storage pricing policy and Yandex Managed Service for YDB pricing policy.

Direct reading from Object StorageDirect reading from Object Storage

This scenario is suitable if you perform all required data processing on your end.

Getting startedGetting started

  1. Create a service account to perform read operations.

  2. Assign the storage.viewer role to the service account for the bucket or the folder containing it.

  3. Create a static access key for the service account.

    Save key_id and secret: you will not see the secret key again.

Read the dataRead the data

AWS CLI
Python
  1. Configure the AWS CLI with the service account key.

  2. View the list of files:

    aws --endpoint-url=https://storage.yandexcloud.net \
      s3 ls s3://<bucket_name>/<prefix>/
    
  3. Download the files:

    aws --endpoint-url=https://storage.yandexcloud.net \
      s3 cp s3://<bucket_name>/<prefix>/ ./data/ --recursive
    

This example reads CSV files with a specified prefix and calculates the sum for a column, just as the SELECT service_name, SUM(cost) ... GROUP BY service_name query would in Yandex Query. Check the column names against the headers of your files.

import boto3
import pandas as pd

s3 = boto3.client(
    "s3",
    endpoint_url="https://storage.yandexcloud.net",
    aws_access_key_id="<key_ID>",
    aws_secret_access_key="<secret_key>",
)

frames = []
paginator = s3.get_paginator("list_objects_v2")
for page in paginator.paginate(Bucket="<bucket_name>", Prefix="<prefix>/"):
    for obj in page.get("Contents", []):
        if obj["Key"].endswith(".csv"):
            body = s3.get_object(Bucket="<bucket_name>", Key=obj["Key"])["Body"]
            frames.append(pd.read_csv(body))

df = pd.concat(frames)
print(df.groupby("service_name")["cost"].sum().sort_values(ascending=False))

Yandex Managed Service for YDBYandex Managed Service for YDB

Entity mappingEntity mapping

Yandex Query

Yandex Managed Service for YDB

Connections to Object Storage

CREATE EXTERNAL DATA SOURCE (external data source) with SOURCE_TYPE = "ObjectStorage"

Data binding

CREATE EXTERNAL TABLE (external table)

Accessing a binding: bindings.<binding_name>

Accessing an external table by name: <table_name>

Authentication via service account

Static access key of the service account stored in the database secrets

Reading files by mask, partitioning (partition projection)

Supported with the same syntax

Formats: csv_with_names, tsv_with_names, json_each_row, json_list, json_as_string, parquet, raw

Supported

Writing the result to a bucket: INSERT INTO <connection>.<path>

Supported with the same syntax

Connections with Managed Service for PostgreSQL, Managed Service for ClickHouse®, Managed Service for MySQL®, and Yandex MPP Analytics for PostgreSQL

Federated queries to external databases

Streaming queries to Yandex Data Streams

No similar option

Connections to Monitoring

No similar option

Saved queries

Store query texts in your repository

Getting startedGetting started

  1. Create a Yandex Managed Service for YDB database with dedicated resources in the same cloud where the data buckets are located.

    Note

    External data sources are available only in databases with dedicated resources. In a serverless database, a query to an external source will fail with the External data sources are disabled error.

  2. Assign the ydb.editor role for the database to the user who will be migrating the queries.

  3. Create a service account and static access key, as described in this section. If your queries write results to a bucket, additionally assign the storage.uploader role to the service account.

  4. Save the query texts, as well as connection and binding settings from Yandex Query; this includes names, bucket paths, format, compression, schema, and partitioning settings.

Federated queries: reading files from Object StorageFederated queries: reading files from Object Storage

This scenario mirrors the operation of Yandex Query: the data remains in the bucket, while the database reads it with every query.

Create an external data sourceCreate an external data source

  1. Store the static key in the database secrets:

    CREATE SECRET s3_key_id WITH (value = "<key_ID>");
    CREATE SECRET s3_secret_key WITH (value = "<secret_key>");
    
  2. Create an external data source. To avoid changing the query text, give it the same name as the connection in Yandex Query:

    CREATE EXTERNAL DATA SOURCE <connection_name> WITH (
        SOURCE_TYPE = "ObjectStorage",
        LOCATION = "https://storage.yandexcloud.net/<bucket_name>/",
        AUTH_METHOD = "AWS",
        AWS_ACCESS_KEY_ID_SECRET_PATH = "s3_key_id",
        AWS_SECRET_ACCESS_KEY_SECRET_PATH = "s3_secret_key",
        AWS_REGION = "ru-central1"
    );
    

    Secrets are not required for a public bucket: specify AUTH_METHOD = "NONE" and do not specify the AWS_* parameters.

  3. Check whether the database can successfully read the bucket:

    SELECT *
    FROM <connection_name>.`<path>/`
    WITH (
        FORMAT = "csv_with_names",
        WITH_INFER = "true"
    )
    LIMIT 10;
    

Migrate data bindingsMigrate data bindings

For each binding, create an external table with the same columns, format, and compression:

CREATE EXTERNAL TABLE <binding_name> (
    date Date NOT NULL,
    service_name Utf8,
    cost Double
) WITH (
    DATA_SOURCE = "<connection_name>",
    LOCATION = "<path>/",
    FORMAT = "csv_with_names",
    COMPRESSION = "gzip"
);

If partitioning or partition projection is configured in the binding, copy the PARTITIONED_BY and projection.* settings without changing them.

Migrate queriesMigrate queries

Queries to connections are migrated unchanged if the external source name matches the connection name. Remove the bindings. prefix from binding requests:

Yandex Query
Yandex Managed Service for YDB
SELECT service_name, SUM(cost) AS total
FROM bindings.`billing`
WHERE date >= Date("2026-09-01")
GROUP BY service_name
ORDER BY total DESC;
SELECT service_name, SUM(cost) AS total
FROM billing
WHERE date >= Date("2026-09-01")
GROUP BY service_name
ORDER BY total DESC;

You can run requests in the management console, or using the YDB CLI or SDK. For example, to save the result to a CSV file, run:

ydb \
  --endpoint <database_endpoint> \
  --database <path_to_database> \
  sql -s 'SELECT service_name, SUM(cost) AS total FROM billing GROUP BY service_name' \
  --format csv > result.csv

Consider performanceConsider performance

The speed of a federated query is limited by the network throughput of the database nodes during reads from Object Storage. Yandex Query distributed reads across a shared pool of nodes; consequently, the same query may take longer to run in a database with a small number of nodes. If speed is important, increase the number of database nodes or move your data to column-oriented tables.

Column-oriented tables: loading data into the databaseColumn-oriented tables: loading data into the database

If the same files are read repeatedly, e.g., by an auto-refreshing dashboard, upload them into a column-oriented table. Queries to the column-oriented table do not read the bucket again.

  1. Create a column-oriented table:

    CREATE TABLE billing_data (
        date Date NOT NULL,
        resource_id Utf8 NOT NULL,
        service_name Utf8,
        cost Double,
        PRIMARY KEY (date, resource_id)
    )
    PARTITION BY HASH(date, resource_id)
    WITH (STORE = COLUMN);
    
  2. Load data from the external table:

    INSERT INTO billing_data
    SELECT date, resource_id, service_name, cost
    FROM billing;
    
  3. To load additional files, run the same query on a schedule with a filter based on date or path, e.g., from a Cloud Functions function with a timer trigger.

  4. Switch queries and dashboards from the external table to billing_data.

Database connectionsDatabase connections

Connections with Yandex Query, Managed Service for PostgreSQL, Managed Service for ClickHouse®, Managed Service for MySQL®, and Yandex MPP Analytics for PostgreSQL are migrated to external data sources of the appropriate type. The syntax of SELECT * FROM<source>.<table> queries does not change. For more information on connection settings, see Federated queries.

Check the resultCheck the result

  1. Run each migrated query against the same files both in Yandex Query and in the environment you migrated to.

  2. Compare the number of rows and the checksums by the key columns:

    SELECT COUNT(*) AS rows, SUM(cost) AS total_cost
    FROM billing
    WHERE date BETWEEN Date("2026-09-01") AND Date("2026-09-30");
    
  3. Switch the dashboards, schedules, and applications that accessed Yandex Query to your new environment.

If something went wrongIf something went wrong

Error or symptom

What to check

External data sources are disabled

The database was created in serverless mode. Create a database with dedicated resources.

Access Denied when reading the bucket

The storage.viewer role assigned to a service account, the key values ​​in the secrets, and the LOCATION value (which must end with /).

Data parsing error

Column types and requirements in the schema. If the file does not contain a column with NOT NULL, the request will fail.

The request is taking longer to complete than in Yandex Query

Number of database nodes. Use column-oriented tables for recurring queries.

If you were unable to resolve your issue, contact support and provide the following:

  • Database ID.
  • Query text and error text.
  • Error time and query ID, if there is one in the output.

Was the article helpful?

Previous
All tutorials
Next
Processing Cloud Logging logs
© 2026 Direct Cursus Technology L.L.C.