Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Query
    • Data formats and compression algorithms
      • Reading data using connections
      • Reading data using bindings
      • Writing data
    • Working with Managed Service for ClickHouse® databases
    • Working with Managed Service for Greenplum® databases
    • Working with Managed Service for MySQL® databases
    • Working with Managed Service for PostgreSQL databases
    • Working with Managed Service for YDB databases
    • Writing metrics to Yandex Monitoring
  • Access management
  • Pricing policy
  • Integration
  • Audit Trails events
  • FAQ

In this article:

  • Writing data using connections
  • Example
  • Writing data using bindings
  • Example
  • Supported write formats
  1. Data sources and targets
  2. Working with Yandex Object Storage
  3. Writing data

Writing data to Yandex Object Storage

Written by
Yandex Cloud
Updated at November 26, 2024
  • Writing data using connections
    • Example
  • Writing data using bindings
    • Example
  • Supported write formats

In Yandex Query, to write data to Yandex Object Storage buckets, you can use connections or bindings.

Example of writing JSON data using bindings:

INSERT INTO `my_binding`
SELECT
    "value" AS value, "name" AS name
FROM
    $data;

For a list of supported formats and data compression algorithms, see Supported write formats.

Writing data using connectionsWriting data using connections

It is convenient to write data using connections for prototyping and initial setup of data write operations. Before writing data to a bucket, create a connection to Object Storage and use the following SQL statement:

INSERT INTO <connection>.<path>
    WITH
    (
        format='<data_format>',
        compression='<compression_format>'
    )
SELECT
    <expression>
FROM
    <query>

Where:

  • <connection>: Name of the connection to Object Storage.
  • <path>: Path within the bucket to write data to.
  • <query>: Query data source query.

ExampleExample

Sample query to write data to Object Storage using connections:

INSERT INTO `connection`.`test/`
    WITH
    (
        format='csv_with_names'
    )
SELECT
    "value" AS value, "name" AS name

Where:

  • connection: Name of the connection to Object Storage.
  • test/: Path within the bucket to write data to.

Writing data using bindingsWriting data using bindings

If you need to make data writes on a regular basis, it is handy to use bindings. This helps avoid entering all the details of handling this data in each query. Before writing data to a bucket, create a data binding in Object Storage and use the following SQL statement:

INSERT INTO `<binding>`
SELECT
    <expression>
FROM
    <query>

Where:

  • <binding>: Name of a binding to Object Storage data.
  • <query>: Query data source query.

ExampleExample

Sample query to write data to Object Storage using bindings:

INSERT INTO `test`
SELECT
    "value" AS value, "name" AS name

Where:

  • test: Name of a binding to Object Storage data.

Supported write formatsSupported write formats

Currently, the following data write formats are supported:

Data format Name in Query
CSV csv_with_names
Parquet parquet

Query supports the following compression algorithms for data writes:

Compression format Name in Query
Gzip gzip
Zstd zstd
LZ4 lz4
Brotli brotli
Bzip2 bzip2
Xz xz

Parquet file format supports its own internal compression algorithms. Query allows writing data in parquet format using the following compression algorithms:

Compression format Name in Query
Snappy No name, by default

Was the article helpful?

Previous
Reading data using bindings
Next
Reading data using connections
© 2025 Direct Cursus Technology L.L.C.