Reading data from Object Storage via Query data bindings
When you need to run the same queries repeatedly, you can use bindings to avoid specifying all query details each time.
Query example for reading data via a binding:
SELECT
*
FROM
`logs`
WHERE
version>1
Setting up a data binding
To create a binding to read data from Object Storage:
-
In the management console
, select the folder where you want to create a binding. -
Navigate to Yandex Query.
-
In the left-hand panel, switch to the Bindings tab.
-
Click
Create. -
Under Connection parameters:
- In the Type field, select
Object Storage. - In the Connection field, select an existing connection or create a new one.
- In the Type field, select
-
Under Binding parameters:
-
In the Name field, specify the binding name.
-
In the Path field, specify the path to bucket data. You can specify parts of file names using
/*, e.g.,yellow/*.csv. -
In the Compression field, specify the data compression method.
-
In the Format field, specify the data storage format.
-
Select a partitioning mode and specify the list of partition columns with their types.
For the Extended mode, specify the partition projection columns.
-
Specify the data columns and their types.
Alternatively, you can click Detect columns to do this automatically.
-
-
To validate the data, click Preview.
-
Click Create.
Data model
Object Storage stores data as binary files. To read data, use the following SQL statement:
SELECT
<expression>
FROM
`<binding>`
WHERE
<filter>;
Where:
<binding>: Name of the data binding you created earlier.
Example of reading data via bindings
Query example for reading Object Storage data via bindings:
SELECT
*
FROM
`binding_name`
Where binding_name is the Object Storage data binding name.