Yandex Cloud
Поиск
Связаться с экспертомПопробовать бесплатно
  • Кейсы
  • Документация
  • Блог
  • Все сервисы
    • 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
    • VibeCraft
    • Yandex Cloud Detection and Response
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • GOST Gateway
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • SourceCraft
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • Статус работы сервисов
  • Marketplace
    • Популярные
    • Инфраструктура и сеть
    • Платформа данных
    • Искусственный интеллект
    • Безопасность
    • Инструменты DevOps
    • Бессерверные вычисления
    • Управление ресурсами
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Облако для интеграторов
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Контент-программа
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Калькулятор цен
    • Тарифы
    • Акции и free tier
  • Кейсы
  • Документация
  • Блог
Сделано на Gravity UI
Проект Яндекса
© 2026 ООО «Яндекс.Облако»
Yandex DataLens
  • Галерея в DataLens
    • Как пользоваться Public API
    • Версионирование
    • История изменений
      • Overview
        • Overview
        • 🚧 [Experimental] Get SQL query
        • 🚧 [Experimental] Create SQL query
        • 🚧 [Experimental] Update SQL query
        • 🚧 [Experimental] Delete SQL query
        • 🚧 [Experimental] Run SQL query
  • Аудитные логи Audit Trails

В этой статье:

  • Request
  • Headers
  • Body
  • Responses
  • 200 OK
  • Body
  • SqlQuery
  1. DataLens Public API
  2. DataLens API (англ.)
  3. SqlQueries
  4. 🚧 [Experimental] Create SQL query
Статья создана
Yandex Cloud
Открыть в Markdown
  • Request
    • Headers
    • Body
  • Responses
  • 200 OK
    • Body
    • SqlQuery

🚧 [Experimental] Create SQL query

Creates a saved SQL query in the specified workbook.

RequestRequest

POST

https://api.datalens.tech/rpc/createSqlQuery

HeadersHeaders

Name

Description

x-dl-api-version

Type: string

API version header.

Const: 3

Example: 3

BodyBody

application/json
{
  "workbookId": "example",
  "name": "example",
  "description": "example",
  "connectionId": "example",
  "query": "example",
  "params": [
    {
      "name": "example",
      "type": null,
      "defaultValue": {}
    }
  ]
}

Name

Description

connectionId

Type: string

ID of the connection. Supported connection types: PostgreSQL, ClickHouse, MySQL, Greenplum, Trino.

Example: example

name

Type: string

Name of the SQL query in the workbook.

Example: example

query

Type: string

Text of the SQL query.

Example: example

workbookId

Type: string

ID of the workbook where the SQL query should be created.

Example: example

description

Type: string

Description of the SQL query.

Example: example

params

Type: array
All of 2 types
  • Type: object

    name

    Type: string

    Example: example

    Example
    {
      "name": "example"
    }
    
  • Any of 3 types
    • Type: object

      type

      Any of 2 types
      • Type: string

        Const: date-interval

        Example: example

      • Type: string

        Const: datetime-interval

        Example: example

      Type of the parameter.

      Example: example

      defaultValue

      Type: object

      from

      Type: string

      Start of the interval.

      Example: example

      to

      Type: string

      End of the interval.

      Example: example

      Default value of the parameter.

      Example
      {
        "from": "example",
        "to": "example"
      }
      
      Example
      {
        "type": "date-interval",
        "defaultValue": {
          "from": "example",
          "to": "example"
        }
      }
      
    • Type: object

      type

      Any of 2 types
      • Type: string

        Const: date

        Example: example

      • Type: string

        Const: datetime

        Example: example

      Type of the parameter.

      Example: example

      defaultValue

      Type: string

      Default value of the parameter.

      Example: example

      Example
      {
        "type": "date",
        "defaultValue": "example"
      }
      
    • Type: object

      type

      Any of 3 types
      • Type: string

        Const: string

        Example: example

      • Type: string

        Const: number

        Example: example

      • Type: string

        Const: boolean

        Example: example

      Type of the parameter.

      Example: example

      defaultValue

      Any of 3 types
      • Type: string

        Example: example

      • Type: number

      • Type: boolean

      Default value of the parameter.

      Example: example

      Example
      {
        "type": "string",
        "defaultValue": "example"
      }
      
    Example
    {
      "type": "date-interval",
      "defaultValue": {
        "from": "example",
        "to": "example"
      }
    }
    

Parameters of the SQL query.

Example
[
  {
    "name": "example",
    "type": "date-interval",
    "defaultValue": {
      "from": "example",
      "to": "example"
    }
  }
]

ResponsesResponses

200 OK200 OK

Response

BodyBody

application/json
{
  "entry": {
    "entryId": "example",
    "scope": "sql_query",
    "type": "example",
    "key": "example",
    "workbookId": "example",
    "collectionId": "example",
    "revId": "example",
    "savedId": "example",
    "publishedId": "example",
    "data": {
      "connectionId": "example",
      "query": "example",
      "statementPositions": [
        [
          null
        ]
      ],
      "params": [
        {}
      ]
    },
    "annotation": {
      "description": "example"
    },
    "createdBy": "example",
    "createdAt": "example",
    "updatedBy": "example",
    "updatedAt": "example",
    "revUpdatedBy": "example",
    "revUpdatedAt": "example",
    "tenantId": "example",
    "hidden": true,
    "version": 0.5,
    "links": {}
  }
}

Name

Description

entry

Type: SqlQuery

Example
{
  "entryId": "example",
  "scope": "sql_query",
  "type": "example",
  "key": "example",
  "workbookId": "example",
  "collectionId": "example",
  "revId": "example",
  "savedId": "example",
  "publishedId": "example",
  "data": {
    "connectionId": "example",
    "query": "example",
    "statementPositions": [
      [
        null
      ]
    ],
    "params": [
      {
        "name": "example"
      }
    ]
  },
  "annotation": {
    "description": "example"
  },
  "createdBy": "example",
  "createdAt": "example",
  "updatedBy": "example",
  "updatedAt": "example",
  "revUpdatedBy": "example",
  "revUpdatedAt": "example",
  "tenantId": "example",
  "hidden": true,
  "version": 0.5,
  "links": {}
}

SqlQuerySqlQuery

Name

Description

annotation

Type: object | null

Annotation of the SQL query.

Example
{
  "description": "example"
}

collectionId

Type: string | null

ID of the collection containing the SQL query.

Example: example

createdAt

Type: string

Date and time when the SQL query was created.

Example: example

createdBy

Type: string

ID of the user who created the SQL query.

Example: example

data

Type: object

connectionId

Type: string

ID of the connection.

Example: example

query

Type: string

Text of the SQL query.

Example: example

statementPositions

Type: unknown[][]

Start and end indexes of the query statements.

Example
[
  [
    null
  ]
]

params

Type: array
All of 2 types
  • Type: object

    name

    Type: string

    Example: example

    Example
    {
      "name": "example"
    }
    
  • Any of 3 types
    • Type: object

      type

      Any of 2 types
      • Type: string

        Const: date-interval

        Example: example

      • Type: string

        Const: datetime-interval

        Example: example

      Type of the parameter.

      Example: example

      defaultValue

      Type: object

      from

      Type: string

      Start of the interval.

      Example: example

      to

      Type: string

      End of the interval.

      Example: example

      Default value of the parameter.

      Example
      {
        "from": "example",
        "to": "example"
      }
      
      Example
      {
        "type": "date-interval",
        "defaultValue": {
          "from": "example",
          "to": "example"
        }
      }
      
    • Type: object

      type

      Any of 2 types
      • Type: string

        Const: date

        Example: example

      • Type: string

        Const: datetime

        Example: example

      Type of the parameter.

      Example: example

      defaultValue

      Type: string

      Default value of the parameter.

      Example: example

      Example
      {
        "type": "date",
        "defaultValue": "example"
      }
      
    • Type: object

      type

      Any of 3 types
      • Type: string

        Const: string

        Example: example

      • Type: string

        Const: number

        Example: example

      • Type: string

        Const: boolean

        Example: example

      Type of the parameter.

      Example: example

      defaultValue

      Any of 3 types
      • Type: string

        Example: example

      • Type: number

      • Type: boolean

      Default value of the parameter.

      Example: example

      Example
      {
        "type": "string",
        "defaultValue": "example"
      }
      
    Example
    {
      "type": "date-interval",
      "defaultValue": {
        "from": "example",
        "to": "example"
      }
    }
    

Parameters of the SQL query.

Example
[
  {
    "name": "example",
    "type": "date-interval",
    "defaultValue": {
      "from": "example",
      "to": "example"
    }
  }
]

Data of the SQL query entry.

Example
{
  "connectionId": "example",
  "query": "example",
  "statementPositions": [
    [
      null
    ]
  ],
  "params": [
    {
      "name": "example",
      "type": null,
      "defaultValue": {}
    }
  ]
}

entryId

Type: string

Unique identifier of the SQL query.

Example: example

hidden

Type: boolean

Whether the SQL query is hidden.

key

Type: string

Key of the SQL query entry.

Example: example

publishedId

Type: string | null

ID of the published SQL query revision.

Example: example

revId

Type: string

ID of the current SQL query revision.

Example: example

savedId

Type: string

ID of the saved SQL query revision.

Example: example

scope

Type: string

Scope of the SQL query entry.

Const: sql_query

Example: example

tenantId

Type: string

ID of the tenant that owns the SQL query.

Example: example

type

Type: string

Type of the SQL query entry.

Example: example

updatedAt

Type: string

Date and time when the SQL query was last updated.

Example: example

updatedBy

Type: string

ID of the user who last updated the SQL query.

Example: example

version

Type: number | null

Schema version of the SQL query.

workbookId

Type: string

ID of the workbook containing the SQL query.

Example: example

links

Type: object | null

Links to the entries the SQL query depends on.

Example
{}

revUpdatedAt

Type: string

Date and time when the current revision was last updated.

Example: example

revUpdatedBy

Type: string

ID of the user who last updated the current revision.

Example: example

Example
{
  "entryId": "example",
  "scope": "sql_query",
  "type": "example",
  "key": "example",
  "workbookId": "example",
  "collectionId": "example",
  "revId": "example",
  "savedId": "example",
  "publishedId": "example",
  "data": {
    "connectionId": "example",
    "query": "example",
    "statementPositions": [
      [
        null
      ]
    ],
    "params": [
      {
        "name": "example"
      }
    ]
  },
  "annotation": {
    "description": "example"
  },
  "createdBy": "example",
  "createdAt": "example",
  "updatedBy": "example",
  "updatedAt": "example",
  "revUpdatedBy": "example",
  "revUpdatedAt": "example",
  "tenantId": "example",
  "hidden": true,
  "version": 0.5,
  "links": {}
}

Была ли статья полезна?

Предыдущая
🚧 [Experimental] Get SQL query
Следующая
🚧 [Experimental] Update SQL query
Сделано на Gravity UI
Проект Яндекса
© 2026 ООО «Яндекс.Облако»