Class: Infrawrench::SqlNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.sql

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ SqlNamespace

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SqlNamespace.

Parameters:



3601
3602
3603
# File 'lib/infrawrench/client.rb', line 3601

def initialize(transport)
  @transport = transport
end

Instance Method Details

#estimate(body:, org_id: nil, request_options: nil) ⇒ Hash

Dry-run cost estimate (e.g. BigQuery byte scan)

Requires permission: resources:read.

POST /api/org/orgId/sql/estimate

Raises on 400: Bad request

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as SqlEstimateRequest.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: (sql_estimate_request)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as JsonObject — see sig/infrawrench/sdk.rbs.

Raises:



3621
3622
3623
3624
3625
3626
3627
3628
3629
# File 'lib/infrawrench/client.rb', line 3621

def estimate(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/sql/estimate",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#execute(body:, org_id: nil, request_options: nil) ⇒ Hash

Run an INSERT/UPDATE/DELETE/DDL statement

Requires permission: resources:execute.

POST /api/org/orgId/sql/execute

Raises on 400: Bad request

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as SqlExecuteRequest.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: (sql_execute_request)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as SqlExecuteResponse — see sig/infrawrench/sdk.rbs.

Raises:



3648
3649
3650
3651
3652
3653
3654
3655
3656
# File 'lib/infrawrench/client.rb', line 3648

def execute(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/sql/execute",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#query(body:, org_id: nil, request_options: nil) ⇒ Hash

Run a read-only SQL query

Routes to the right driver: REST executeQuery (BigQuery, Databricks), per-resource SQL driver (Neon, Turso) or account-level SQL driver (Postgres, MySQL).

Requires permission: resources:execute.

POST /api/org/orgId/sql/query

Raises on 400: Bad request

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as SqlQueryRequest.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: (sql_query_request)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as SqlQueryResponse | JsonObject — see sig/infrawrench/sdk.rbs.

Raises:



3679
3680
3681
3682
3683
3684
3685
3686
3687
# File 'lib/infrawrench/client.rb', line 3679

def query(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/sql/query",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end