Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • 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
    • Data formats and compression algorithms
      • Reading data via connections
      • Reading data via bindings
      • Writing data
    • Working with Managed Service for ClickHouse® databases
    • Working with Yandex MPP Analytics for PostgreSQL databases
    • Working with Managed Service for MySQL® databases
    • Working with Managed Service for PostgreSQL databases
    • Working with Managed Service for YDB databases
    • Reading Iceberg tables
  • Access management
  • Pricing policy
  • Integrations
  • Audit Trails events
  • FAQ

In this article:

  • Setting up a connection
  • Data model
  • Data schema
  • Automatic schema inference
  • Data path formats
  • Example of reading data via connections
  1. Data sources and sinks
  2. Working with Yandex Object Storage
  3. Reading data via connections

Reading data from Object Storage via Query connections

Written by
Yandex Cloud
Updated at July 7, 2026
View in Markdown
  • Setting up a connection
  • Data model
    • Data schema
    • Automatic schema inference
    • Data path formats
  • Example of reading data via connections

Using Yandex Object Storage connections is convenient for prototyping and initial data access configuration.

Query example for reading data:

SELECT
    *
FROM
    object_storage.`*.tsv`
WITH
(
    format=tsv_with_names,
    SCHEMA
    (
        `timestamp` Uint32,
        action String
    )
);

Setting up a connectionSetting up a connection

To create a connection to Object Storage:

  1. In the management console, select the folder where you want to create a connection.

  2. Navigate to Yandex Query.

  3. In the left-hand panel, switch to the Connections tab.

  4. Click Create new.

  5. Specify the connection settings:

    1. Under General parameters:

      • Name: Object Storage connection name.
      • Type: Object Storage.
    2. Under Connection type parameters:

      • Bucket auth: Select Public or Private depending on the type of read access to objects in the bucket.

        For a public bucket, specify a name in the Bucket field.
        For a private bucket:

        • Select Cloud and Folder where the data source is located.

        • Select an existing bucket or create a new one.

        • Select an existing service account or create a new one. Assign it the storage.viewer role required to access the data.

          To use the service account on your behalf, you need the iam.serviceAccounts.user role.

  6. Click Create.

Data modelData model

Object Storage stores data as binary files. To read data, use the following SQL statement:

SELECT
    <expression>
FROM
    <connection>.<path>
WITH(
    FORMAT = "<data_format>",
    COMPRESSION = "<compression_format>",
    SCHEMA = (<schema_description>))
WHERE
    <filter>;

Where:

  • <connection>: Storage connection name.
  • <path>: Path to file(s) within the bucket. Supports the * wildcard.
  • <data_format>: File data format.
  • <compression_format>: File compression format.
  • <data_schema>: Description of data stored in files.

Data schemaData schema

The data schema includes the following fields:

  • Field name
  • Field type
  • Required flag

For example, the schema below describes a required field Year of type Int32:

Year Int32 NOT NULL

If a NOT NULL field is missing from the file being processed, the operation will terminate with an error. If a nullable field is missing from the file being processed, no error will occur, and the field will be set to NULL. The NULL keyword may be omitted in nullable fields.

Automatic schema inferenceAutomatic schema inference

Automatic schema inference is supported for all data formats except raw and json_as_string. It is convenient when a schema has many fields. Instead of entering them manually, you can use the WITH_INFER hint:

SELECT
    <expression>
FROM
    <connection>.<path>
WITH(
    FORMAT = "<data_format>",
    COMPRESSION = "<compression_format>",
    WITH_INFER="true")
WHERE
    <filter>;

Where:

  • <connection>: Storage connection name.
  • <path>: Path to file(s) within the bucket. Supports the * wildcard.
  • <data_format>: File data format.
  • <compression_format>: File compression format.

This query will automatically infer field names and types.

Data path formatsData path formats

Yandex Query supports the following data path formats:

Path format Description Example
Path ends with / Points to a folder Path /a addresses everything inside a folder:
/a/b/c/d/1.txt
/a/b/2.csv
Path contains a * wildcard Points to any file in any subfolder matching the pattern Path /a/*.csv addresses all files in the following subfolders:
/a/b/c/1.csv
/a/2.csv
/a/b/c/d/e/f/g/2.csv
Path does not end with / and contains no wildcards Points to an individual file Path /a/b.csv refers to the specific file /a/b.csv

Example of reading data via connectionsExample of reading data via connections

Query example for reading data from Object Storage:

SELECT
    *
FROM
    connection.`folder/filename.csv`
WITH(
    format='csv_with_names',
    SCHEMA
    (
        Year int,
        Manufacturer String,
        Model String,
        Price Double
    )
);

Where:

  • connection: Object Storage connection name.
  • folder/filename.csv: File path within the Object Storage bucket.
  • SCHEMA: Data schema described in the file.

Was the article helpful?

Previous
Data formats and compression algorithms
Next
Reading data via bindings
© 2026 Direct Cursus Technology L.L.C.