Skip to content

Latest commit

 

History

History
313 lines (205 loc) · 43.3 KB

File metadata and controls

313 lines (205 loc) · 43.3 KB

Sandbox

Overview

Available Operations

create

CreateSandbox

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.create()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxExecServiceCreateSandboxResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

exec

Exec

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.exec()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
command Optional[str] ➖ N/A
kind Optional[str] ➖ "" | "bash" | "sh" | "shell" | "python" | "py"
env Dict[str, str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxExecServiceExecResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

execute_code

ExecuteCode

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.execute_code()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
code Optional[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxExecServiceExecuteCodeResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

get_tool_availability

GetToolAvailability

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.get_tool_availability(body={})

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
body models.TextqlRPCPublicSandboxExecGetToolAvailabilityRequest ✔️ N/A
connect_timeout_ms Optional[float] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxExecServiceGetToolAvailabilityResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

load_connector_data

LoadConnectorData

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.load_connector_data()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
sandbox_id Optional[str] ➖ N/A
connector_id Optional[int] ➖ N/A
query Optional[str] ➖ N/A
tql_path Optional[str] ➖ N/A
params Dict[str, Nullable[models.GoogleProtobufValue]] ➖ Represents a JSON object.

An unordered key-value map, intending to perfectly capture the semantics of a
JSON object. This enables parsing any arbitrary JSON payload as a message
field in ProtoJSON format.

This follows RFC 8259 guidelines for interoperable JSON: notably this type
cannot represent large Int64 values or NaN/Infinity numbers,
since the JSON format generally does not support those values in its number
type.

If you do not intend to parse arbitrary JSON into your message, a custom
typed message should be preferred instead of using this type.
max_rows Optional[int] ➖ N/A
dataframe_name OptionalNullable[str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxExecServiceLoadConnectorDataResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

execute_bash

Runs in the caller's own worker; no connector/source scoping.

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.execute_bash()

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connect_timeout_ms Optional[float] ➖ N/A
script Optional[str] ➖ N/A
env Dict[str, str] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxQueryServiceExecuteBashResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*

execute_query

ExecuteQuery

Example Usage

import os
from textql_sdk import Textql


with Textql(
    api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:

    res = textql.sandbox.execute_query(body={
        "sql_query": {},
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
body models.TextqlRPCPublicSandboxQuerySandboxExecuteQueryRequest ✔️ N/A
connect_timeout_ms Optional[float] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.SandboxQueryServiceExecuteQueryResponse

Errors

Error Type Status Code Content Type
errors.TextqlDefaultError 4XX, 5XX */*