> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ocient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# execute

> Alternative GET method for executing SQL statements. This method passes parameters as URL query parameters. This method does not support the params body parameter.

Specify which database to access in the query parameters. If you do not specify a database, the connection defaults to the database from the authentication token or system settings.

This method is most suitable for simple, read-only queries where the statement can be safely included in a URL. For complex queries or those with parameters, use the POST method instead.



## OpenAPI

````yaml /openapi/generated-api-methods.json GET /v1/execute/{database}
openapi: 3.1.0
info:
  title: Generated API methods
  version: 1.0.0
  description: Generated from imported ApiMethodV2 blocks.
servers:
  - url: https://{sql_node}
    variables:
      sql_node:
        default: sql_node
  - url: http://oc1-lts0:9090
security: []
paths:
  /v1/execute/{database}:
    get:
      tags:
        - Ocient HTTP Query API
      summary: execute
      description: >-
        Alternative GET method for executing SQL statements. This method passes
        parameters as URL query parameters. This method does not support the
        params body parameter.


        Specify which database to access in the query parameters. If you do not
        specify a database, the connection defaults to the database from the
        authentication token or system settings.


        This method is most suitable for simple, read-only queries where the
        statement can be safely included in a URL. For complex queries or those
        with parameters, use the POST method instead.
      operationId: getOcientHttpQueryApiExecute
      parameters:
        - name: database
          in: path
          required: true
          description: >-
            The specific database in your system for the API call. 


            If you do not specify the database, the executed query defaults to
            the database from the authentication token or system settings.


            If you include a database in the path, this value overrides any
            alternate database value specified as a body parameter.
          schema:
            type: string
        - name: statement
          in: query
          required: true
          description: >-
            A valid SQL statement to execute. The statement must be URL-encoded,
            e.g., statement=SELECT%20*%20FROM%20customers%20LIMIT%2010%3B
          schema:
            type: string
        - name: database
          in: query
          required: false
          description: >-
            A specific database in your system for the API call. 


            If you do not specify the database, the executed query defaults to
            the database from the authentication token or system settings.
          schema:
            type: string
        - name: format
          in: query
          required: false
          description: >-
            Sets the response format. 


            Supported values are: 


            "array" — Returns the schema and data as arrays (more efficient for
            large data sets). (default)

            "collection" — Returns data as JSON objects (more convenient for
            client processing).
          schema:
            type: string
        - name: fetch_size
          in: query
          required: false
          description: >-
            The number of rows to return in each chunk for streaming responses.
            This value must be 0 or greater. A value of 0 (default) means the
            database determines how many rows to return. 


            Use smaller values for interactive applications (100-1000 rows). For
            batch processing, use larger values (5000-10000 rows).
          schema:
            type: string
        - name: Authorization
          in: header
          required: true
          description: >-
            An access token to connect to your Ocient System. 


            To receive an access token, you must provide your username and
            password using the login endpoint. 


            The system passes the credentials using the Authorization HTTP
            header using Base64-encoded Basic Authentication.
          schema:
            type: string
        - name: Content-Type
          in: header
          required: true
          description: >-
            Specifies the request body format. Options include: 


            application/json


            Description: The standard option for submitting queries and
            receiving responses as a single JSON object or array. Use when
            submitting queries with relatively small or moderate result sets or
            when you want the entire result set in one response.


            application/stream+json


            Description: Enables streaming of multiple JSON objects, allowing
            the API to send results as they become available. Use when querying
            large tables or expecting a large volume of results or when you want
            to process each row or result as soon as it is received, without
            waiting for the full response.
          schema:
            type: string
        - name: accept-encoding
          in: header
          required: false
          description: >-
            Supported compression algorithms for responses. You can specify
            multiple algorithms as a comma-separated list. 


            Supported values are: 

            'gzip' 

            'deflate' 

            'br' (Brotli)

            or combinations like: 'gzip, br'.


            Note: For large result sets, compression can impact performance.
            Without compression, the result sets can be chunks of rows processed
            in a streaming fashion. With compression, the entire result set must
            be compressed before it is returned to the client. The client side
            must decompress the entire result set before processing any rows.
          schema:
            type: string
        - name: accept
          in: header
          required: false
          description: >-
            Supported response media types. Regardless of the Accept header, the
            API returns large query results using chunked encoding. Also, see
            the note about compression in the accept-encoding parameter.


            Supported values are: 


            "application/json" (default)

            "application/stream+json"
          schema:
            type: string
        - name: preferred-encoding
          in: header
          required: false
          description: >-
            Indicates the preferred encoding type from those specified in the
            accept-encoding parameter. This header provides fine-grained control
            when the accept-encoding parameter contains multiple values,
            allowing the client to specify which encoding is preferred for this
            specific request explicitly.


            Supported values are: 


            "gzip" 

            "br"
          schema:
            type: string
        - name: preferred-compression-level
          in: header
          required: false
          description: >-
            Specifies the chosen compression level for the selected encoding
            algorithm. Values typically range from 1 (fastest, least
            compression) to 9 (slowest, maximum compression). The exact behavior
            depends on the specific compression algorithm.
          schema:
            type: string
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  query_id:
                    type: string
                  status:
                    type: object
                    properties:
                      reason:
                        type: string
                      sql_state:
                        type: string
                      vendor_code:
                        type: integer
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        c1:
                          type: integer
              examples:
                response:
                  value:
                    query_id: 2d5af900-cb02-44f4-b974-6264d2133e96
                    status:
                      reason: The operation completed successfully
                      sql_state: '00000'
                      vendor_code: 0
                    data:
                      - c1: 1
                      - c1: 2
      servers:
        - url: https://{sql_node}
          variables:
            sql_node:
              default: sql_node
      x-codeSamples:
        - lang: curl
          label: curl
          source: |-
            curl -u 'admin@system:admin' \
                'https://my_sql_node.com/v1/execute?statement=SELECT%20*%20FROM%20sys.dummy2&database=system&format=collection'

````