Skip to main content

Update a Statement

PUT 

/sql/v1/organizations/:organization_id/environments/:environment_id/statements/:statement_name

General Availability

Make a request to update a statement. The request will fail with a 409 Conflict error if the Statement has changed since it was fetched. In this case, do a GET, reapply the modifications, and try the update again.

Request

Responses

A Statement is being updated.

Response Headers
    X-Request-Id

    The unique identifier for the API request.

OpenAPI definition (YAML)
paths:
  /sql/v1/organizations/{organization_id}/environments/{environment_id}/statements/{statement_name}:
    put:
      x-lifecycle-stage: General Availability
      x-self-access: true
      x-request-access-name: SQL API v1
      operationId: updateSqlv1Statement
      description: '[![General Availability](https://img.shields.io/badge/Lifecycle%20Stage-General%20Availability-%2345c6e8)](#section/Versioning/API-Lifecycle-Policy)


        Make a request to update a statement.

        The request will fail with a 409 Conflict error if the Statement has changed since it was fetched.

        In this case, do a GET, reapply the modifications, and try the update again.'
      parameters:
      - in: path
        name: organization_id
        schema:
          type: string
          format: uuid
        required: true
        description: The unique identifier for the organization.
      - in: path
        name: environment_id
        required: true
        schema:
          type: string
        description: The unique identifier for the environment.
      - name: statement_name
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the statement.
      tags:
      - Statements (sql/v1)
      security:
      - resource-api-key: []
      - global-api-key: []
      - external-access-token: []
      responses:
        '202':
          description: A Statement is being updated.
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
        '400':
          description: Bad Request
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
          content:
            application/json:
              schema:
                type: object
                description: Provides information about problems encountered while performing an operation.
                required:
                - errors
                properties:
                  errors:
                    description: List of errors which caused this operation to fail
                    type: array
                    items:
                      type: object
                      description: Describes a particular error encountered while performing an operation.
                      properties:
                        id:
                          description: A unique identifier for this particular occurrence of the problem.
                          type: string
                          maxLength: 255
                        status:
                          description: The HTTP status code applicable to this problem, expressed as a
                            string value.
                          type: string
                        code:
                          description: An application-specific error code, expressed as a string value.
                          type: string
                        title:
                          description: A short, human-readable summary of the problem. It **SHOULD NOT**
                            change from occurrence to occurrence of the problem, except for purposes of
                            localization.
                          type: string
                        detail:
                          description: A human-readable explanation specific to this occurrence of the
                            problem.
                          type: string
                        source:
                          type: object
                          description: If this error was caused by a particular part of the API request,
                            the source will point to the query string parameter or request body property
                            that caused it.
                          properties:
                            pointer:
                              description: A JSON Pointer [RFC6901] to the associated entity in the request
                                document [e.g. "/spec" for a spec object, or "/spec/title" for a specific
                                field].
                              type: string
                            parameter:
                              description: A string indicating which query parameter caused the error.
                              type: string
                        error_code:
                          type: integer
                          format: int32
                        message:
                          type: string
                          nullable: true
                      additionalProperties: false
                      title: Error
                    uniqueItems: true
                title: Failure
              example:
                errors:
                - id: ed42afdc-f0d5-4c0d-b428-9fc6ed6e279d
                  status: '400'
                  code: invalid_filter
                  title: Invalid Filter
                  detail: The 'delorean' resource can't be filtered by 'num_doors'
                  source:
                    parameter: num_doors
        '401':
          x-summary: Unauthorized
          description: The request lacks valid authentication credentials for this resource.
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
            WWW-Authenticate:
              schema:
                type: string
              description: The unique identifier for the API request.
              example: Basic error="invalid_key", error_description="The API Key is invalid"
          content:
            application/json:
              schema:
                type: object
                description: Provides information about problems encountered while performing an operation.
                required:
                - errors
                properties:
                  errors:
                    description: List of errors which caused this operation to fail
                    type: array
                    items:
                      type: object
                      description: Describes a particular error encountered while performing an operation.
                      properties:
                        id:
                          description: A unique identifier for this particular occurrence of the problem.
                          type: string
                          maxLength: 255
                        status:
                          description: The HTTP status code applicable to this problem, expressed as a
                            string value.
                          type: string
                        code:
                          description: An application-specific error code, expressed as a string value.
                          type: string
                        title:
                          description: A short, human-readable summary of the problem. It **SHOULD NOT**
                            change from occurrence to occurrence of the problem, except for purposes of
                            localization.
                          type: string
                        detail:
                          description: A human-readable explanation specific to this occurrence of the
                            problem.
                          type: string
                        source:
                          type: object
                          description: If this error was caused by a particular part of the API request,
                            the source will point to the query string parameter or request body property
                            that caused it.
                          properties:
                            pointer:
                              description: A JSON Pointer [RFC6901] to the associated entity in the request
                                document [e.g. "/spec" for a spec object, or "/spec/title" for a specific
                                field].
                              type: string
                            parameter:
                              description: A string indicating which query parameter caused the error.
                              type: string
                        error_code:
                          type: integer
                          format: int32
                        message:
                          type: string
                          nullable: true
                      additionalProperties: false
                      title: Error
                    uniqueItems: true
                title: Failure
              example:
                errors:
                - id: ed42afdc-f0d5-4c0d-b428-9fc6ed6e279d
                  status: '401'
                  code: user_unauthenticated
                  title: Authentication Required
                  detail: Valid authentication credentials must be provided
        '403':
          x-summary: Forbidden
          description: The access credentials were considered insufficient to grant access
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
          content:
            application/json:
              schema:
                type: object
                description: Provides information about problems encountered while performing an operation.
                required:
                - errors
                properties:
                  errors:
                    description: List of errors which caused this operation to fail
                    type: array
                    items:
                      type: object
                      description: Describes a particular error encountered while performing an operation.
                      properties:
                        id:
                          description: A unique identifier for this particular occurrence of the problem.
                          type: string
                          maxLength: 255
                        status:
                          description: The HTTP status code applicable to this problem, expressed as a
                            string value.
                          type: string
                        code:
                          description: An application-specific error code, expressed as a string value.
                          type: string
                        title:
                          description: A short, human-readable summary of the problem. It **SHOULD NOT**
                            change from occurrence to occurrence of the problem, except for purposes of
                            localization.
                          type: string
                        detail:
                          description: A human-readable explanation specific to this occurrence of the
                            problem.
                          type: string
                        source:
                          type: object
                          description: If this error was caused by a particular part of the API request,
                            the source will point to the query string parameter or request body property
                            that caused it.
                          properties:
                            pointer:
                              description: A JSON Pointer [RFC6901] to the associated entity in the request
                                document [e.g. "/spec" for a spec object, or "/spec/title" for a specific
                                field].
                              type: string
                            parameter:
                              description: A string indicating which query parameter caused the error.
                              type: string
                        error_code:
                          type: integer
                          format: int32
                        message:
                          type: string
                          nullable: true
                      additionalProperties: false
                      title: Error
                    uniqueItems: true
                title: Failure
              example:
                errors:
                - id: ed42afdc-f0d5-4c0d-b428-9fc6ed6e279d
                  status: '403'
                  code: user_unauthorized
                  title: User Access Unauthorized
                  detail: The user 'mcfly' is not allowed to access the 'delorean' resource without the
                    'plutonium' role.
        '404':
          description: Not Found
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
          content:
            application/json:
              schema:
                type: object
                description: Provides information about problems encountered while performing an operation.
                required:
                - errors
                properties:
                  errors:
                    description: List of errors which caused this operation to fail
                    type: array
                    items:
                      type: object
                      description: Describes a particular error encountered while performing an operation.
                      properties:
                        id:
                          description: A unique identifier for this particular occurrence of the problem.
                          type: string
                          maxLength: 255
                        status:
                          description: The HTTP status code applicable to this problem, expressed as a
                            string value.
                          type: string
                        code:
                          description: An application-specific error code, expressed as a string value.
                          type: string
                        title:
                          description: A short, human-readable summary of the problem. It **SHOULD NOT**
                            change from occurrence to occurrence of the problem, except for purposes of
                            localization.
                          type: string
                        detail:
                          description: A human-readable explanation specific to this occurrence of the
                            problem.
                          type: string
                        source:
                          type: object
                          description: If this error was caused by a particular part of the API request,
                            the source will point to the query string parameter or request body property
                            that caused it.
                          properties:
                            pointer:
                              description: A JSON Pointer [RFC6901] to the associated entity in the request
                                document [e.g. "/spec" for a spec object, or "/spec/title" for a specific
                                field].
                              type: string
                            parameter:
                              description: A string indicating which query parameter caused the error.
                              type: string
                        error_code:
                          type: integer
                          format: int32
                        message:
                          type: string
                          nullable: true
                      additionalProperties: false
                      title: Error
                    uniqueItems: true
                title: Failure
              example:
                errors:
                - id: ed42afdc-f0d5-4c0d-b428-9fc6ed6e279d
                  status: '404'
                  title: Not Found
        '429':
          description: Rate Limit Exceeded
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
            X-RateLimit-Limit:
              schema:
                type: integer
              description: The maximum number of requests you're permitted to make per time period.
            X-RateLimit-Remaining:
              schema:
                type: integer
              description: The number of requests remaining in the current rate limit window.
            X-RateLimit-Reset:
              schema:
                type: integer
              description: "The relative time in seconds until the current rate-limit window resets. \
                \ \n  \n**Important:** This differs from Github and Twitter's same-named header which\
                \ uses UTC epoch seconds. We use relative time to avoid client/server time synchronization\
                \ issues."
            Retry-After:
              schema:
                type: integer
              description: The number of seconds to wait until the rate limit window resets. Only sent
                when the rate limit is reached.
        '500':
          description: Oops, something went wrong!
          headers:
            X-Request-Id:
              schema:
                type: string
              description: The unique identifier for the API request.
          content:
            application/json:
              schema:
                type: object
                description: Provides information about problems encountered while performing an operation.
                required:
                - errors
                properties:
                  errors:
                    description: List of errors which caused this operation to fail
                    type: array
                    items:
                      type: object
                      description: Describes a particular error encountered while performing an operation.
                      properties:
                        id:
                          description: A unique identifier for this particular occurrence of the problem.
                          type: string
                          maxLength: 255
                        status:
                          description: The HTTP status code applicable to this problem, expressed as a
                            string value.
                          type: string
                        code:
                          description: An application-specific error code, expressed as a string value.
                          type: string
                        title:
                          description: A short, human-readable summary of the problem. It **SHOULD NOT**
                            change from occurrence to occurrence of the problem, except for purposes of
                            localization.
                          type: string
                        detail:
                          description: A human-readable explanation specific to this occurrence of the
                            problem.
                          type: string
                        source:
                          type: object
                          description: If this error was caused by a particular part of the API request,
                            the source will point to the query string parameter or request body property
                            that caused it.
                          properties:
                            pointer:
                              description: A JSON Pointer [RFC6901] to the associated entity in the request
                                document [e.g. "/spec" for a spec object, or "/spec/title" for a specific
                                field].
                              type: string
                            parameter:
                              description: A string indicating which query parameter caused the error.
                              type: string
                        error_code:
                          type: integer
                          format: int32
                        message:
                          type: string
                          nullable: true
                      additionalProperties: false
                      title: Error
                    uniqueItems: true
                title: Failure
              example:
                errors:
                - id: ed42afdc-f0d5-4c0d-b428-9fc6ed6e279d
                  status: '500'
                  code: out_of_gas
                  title: DeLorean Out Of Gas
                  detail: The DeLorean has run out of gas, but Doc Brown will fill 'er up for you asap
      requestBody:
        content:
          application/json:
            schema:
              allOf:
              - type: object
                description: '`Statement` represents a core resource used to model SQL statements for
                  execution.

                  A statement generalizes DDL, DML, DQL, etc., but doesn’t attempt to handle session

                  management or any higher-level functionality.

                  The API allows you to list, create, read, and delete your statements.

                  ## The Statements Model

                  <SchemaDefinition schemaRef="#/components/schemas/sql.v1.Statement" />'
                properties:
                  metadata:
                    allOf:
                    - description: The metadata of the statement.
                      required:
                      - self
                      properties:
                        self:
                          description: Self is a Uniform Resource Locator (URL) at which an object can
                            be addressed. This URL encodes the service location, API version, and other
                            particulars necessary to locate the resource at a point in time
                          type: string
                          format: uri
                          example: https://flink.us-west1.aws.confluent.cloud/sql/v1/environments/env-123/statements/my-statement
                        created_at:
                          type: string
                          format: date-time
                          example: '1996-03-19T01:02:03-04:05'
                          description: The date and time at which this object was created. It is represented
                            in RFC3339 format and is in UTC.
                        updated_at:
                          type: string
                          format: date-time
                          example: '2025-11-10T16:20:00Z'
                          description: The date and time at which this object was last updated. It is
                            represented in RFC3339 format and is in UTC.
                        uid:
                          type: string
                          example: 12345678-1234-1234-1234-123456789012
                          description: A system generated globally unique identifier for this resource.
                        resource_version:
                          type: string
                          example: a23av
                          description: A system generated string that uniquely identifies the version
                            of this resource.
                        labels:
                          type: object
                          description: A map of key-value pairs that describe the resource.
                          additionalProperties:
                            type: string
                          example:
                            user.confluent.io/hidden: 'true'
                      readOnly: true
                      title: StatementObjectMeta
                    - properties:
                        self:
                          example: https://flink.us-west1.aws.confluent.cloud/sql/v1/environments/env-123/statements/my-statement
                        uid:
                          example: 12345678-1234-1234-1234-123456789012
                        resource_version:
                          example: a23av
                        resource_name:
                          example: ''
                        labels:
                          type: object
                          additionalProperties:
                            type: string
                  spec:
                    type: object
                    description: The specs of the Statement
                    properties:
                      properties:
                        type: object
                        example:
                          sql.current-catalog: my_environment
                          sql.current-database: my_kafka_cluster
                        description: A map (key-value pairs) of statement properties.
                        additionalProperties:
                          type: string
                        maxProperties: 8192
                      compute_pool_id:
                        type: string
                        example: fcp-00000
                        description: "The id associated with the compute pool in context. \nIf not specified,\
                          \ the statement will use the default compute pool. The default pool is automatically\
                          \ determined by the system."
                        maxLength: 255
                      stopped:
                        type: boolean
                        description: Indicates whether the statement should be stopped.
                        example: false
                    x-enable-listmeta: true
                    x-enable-objectmeta: true
                    title: sql.v1.StatementSpec
                  result:
                    type: object
                    description: '`Statement Result` represents a resource used to model results of SQL
                      statements.

                      The API allows you to read your SQL statement result.'
                    required:
                    - api_version
                    - kind
                    - metadata
                    properties:
                      api_version:
                        type: string
                        enum:
                        - sql/v1
                        description: APIVersion defines the schema version of this representation of a
                          resource.
                        example: sql/v1
                      kind:
                        type: string
                        description: Kind defines the object this REST resource represents.
                        enum:
                        - StatementResult
                      metadata:
                        allOf:
                        - type: object
                          description: ListMeta describes metadata that resource collections may have
                          properties:
                            self:
                              description: Self is a Uniform Resource Locator (URL) at which an object
                                can be addressed. This URL encodes the service location, API version,
                                and other particulars necessary to locate the resource at a point in time
                              type: string
                              example: https://flink.us-west1.aws.confluent.cloud/sql/v1/environments/env-123/statements
                            next:
                              description: A URL that can be followed to get the next batch of results.
                              type: string
                              example: https://flink.us-west1.aws.confluent.cloud/sql/v1/environments/env-abc123/statements?page_token=UvmDWOB1iwfAIBPj6EYb
                          title: ResultListMeta
                      results:
                        allOf:
                        - type: object
                          description: A results property that contains a data property that contains
                            an array of results.
                          properties:
                            data:
                              type: array
                              description: 'A data property that contains an array of results. Each entry
                                in the array is a separate result.


                                The value of `op` attribute (if present) represents the kind of change
                                that a row can describe in a changelog:


                                `0`: represents `INSERT` (`+I`), i.e. insertion operation;


                                `1`: represents `UPDATE_BEFORE` (`-U`), i.e. update operation with the
                                previous content of the updated row.

                                This kind should occur together with `UPDATE_AFTER` for modelling an update
                                that needs to retract

                                the previous row first. It is useful in cases of a non-idempotent update,
                                i.e., an update of a row that is not

                                uniquely identifiable by a key;


                                `2`: represents `UPDATE_AFTER` (`+U`), i.e. update operation with new
                                content of the updated row;

                                This kind CAN occur together with `UPDATE_BEFORE` for modelling an update
                                that

                                needs to retract the previous row first or it describes an idempotent
                                update, i.e., an

                                update of a row that is uniquely identifiable by a key;


                                `3`: represents `DELETE` (`-D`), i.e. deletion operation;


                                Defaults to `0`.

                                '
                              items: {}
                              example:
                              - op: 0
                                row:
                                - '101'
                                - Jay
                                - - null
                                  - abc
                                - - null
                                  - '456'
                                - 1990-01-12 12:00.12
                                - - - null
                                    - Alice
                                  - - '42'
                                    - Bob
                          title: sql.v1.StatementResultResults
                    title: sql.v1.StatementResult
                title: sql.v1.Statement
              - type: object
                required:
                - spec
                - metadata
                properties:
                  spec:
                    type: object
                    required:
                    - stopped
                  metadata:
                    type: object
                    required:
                    - resource_version
      servers:
      - url: https://flink.region.provider.confluent.cloud
        description: Flink Compute Pool Endpoint
      jsonRequestBodyExample:
        name: sql123
        organization_id: 3fa85f64-5717-4562-b3fc-2c963f66afa6
        environment_id: string
        spec:
          statement: SELECT * FROM TABLE WHERE VALUE1 = VALUE2;
          properties:
            sql.current-catalog: my_environment
            sql.current-database: my_kafka_cluster
          compute_pool_id: fcp-00000
          principal: sa-abc123
          stopped: false
        result:
          api_version: sql/v1
          kind: StatementResult
          metadata:
            self: https://flink.us-west1.aws.confluent.cloud/sql/v1/environments/env-123/statements
            next: https://flink.us-west1.aws.confluent.cloud/sql/v1/environments/env-abc123/statements?page_token=UvmDWOB1iwfAIBPj6EYb
          results:
            data:
            - op: 0
              row:
              - '101'
              - Jay
              - - null
                - abc
              - - null
                - '456'
              - 1990-01-12 12:00.12
              - - - null
                  - Alice
                - - '42'
                  - Bob