QueryApi
All URIs are relative to https://app.coactive.ai
delete_query_by_id
bool, date, datetime, dict, float, int, list, str, none_type delete_query_by_id(query_id)
Delete query by id
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import QueryApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = QueryApi(api_client)
query_id = "57552f03-87af-4847-a83e-e46a320af0c2"
# example passing only required values which don't have defaults set
try:
# Delete query by id
api_response = api_instance.delete_query_by_id(query_id)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->delete_query_by_id: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
query_id |
str |
The unique identifier for the query |
|
Return type
bool, date, datetime, dict, float, int, list, str, none_type
Authorization
HTTPBearer
- Content-Type: Not defined
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Query successfully deleted |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
404 |
Query not found |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
execute_query
QueryResponse execute_query(query_request)
Create and enqueue the execution of a SQL query
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import QueryApi
from coactive.model.query_response import QueryResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.query_request import QueryRequest
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = QueryApi(api_client)
query_request = QueryRequest(
query="select * from coactive_images_table",
embedding_id="b78a6e5f-5434-46c4-9e4f-ded092147584",
)
# example passing only required values which don't have defaults set
try:
# Create and enqueue a SQL query
api_response = api_instance.execute_query(query_request)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->execute_query: %s\n" % e)
|
Parameters
Return type
QueryResponse
Authorization
HTTPBearer
- Content-Type: application/json
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
The created query |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
404 |
Not found |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
get_queries
QueryListResponse get_queries()
Get paginated list of queries. If query ids are provided, the returned list will include only those queries. Queries not found from the provided ids list will be ignored.
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import QueryApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
from coactive.model.query_list_response import QueryListResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = QueryApi(api_client)
offset = 0 # (optional) if omitted the server will use the default value of 0
limit = 100 # (optional) if omitted the server will use the default value of 100
ids = ["57552f03-87af-4847-a83e-e46a320af0c2"] # (optional)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get paginated list of queries
api_response = api_instance.get_queries(offset=offset, limit=limit, ids=ids)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->get_queries: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
offset |
int, none_type |
Starting index to return |
[optional] if omitted the server will use the default value of 0 |
limit |
int, none_type |
Max number of items to return |
[optional] if omitted the server will use the default value of 100 |
ids |
[str], none_type |
Query ids to include in the result |
[optional] |
Return type
QueryListResponse
Authorization
HTTPBearer
- Content-Type: Not defined
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Paginated list of queries |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
404 |
Not found |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
get_query_by_id
QueryResultResponse get_query_by_id(query_id)
Get query by id including paginated query results if the query execution is complete
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import QueryApi
from coactive.model.query_result_response import QueryResultResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = QueryApi(api_client)
query_id = "57552f03-87af-4847-a83e-e46a320af0c2"
offset = 0 # (optional) if omitted the server will use the default value of 0
limit = 100 # (optional) if omitted the server will use the default value of 100
exclude_results = False # (optional) if omitted the server will use the default value of False
# example passing only required values which don't have defaults set
try:
# Get query by id, including results
api_response = api_instance.get_query_by_id(query_id)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->get_query_by_id: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get query by id, including results
api_response = api_instance.get_query_by_id(query_id, offset=offset, limit=limit, exclude_results=exclude_results)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->get_query_by_id: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
query_id |
str |
The unique identifier for the query |
|
offset |
int, none_type |
Starting index to return |
[optional] if omitted the server will use the default value of 0 |
limit |
int, none_type |
Max number of items to return |
[optional] if omitted the server will use the default value of 100 |
exclude_results |
bool, none_type |
Optionally exclude results from the response |
[optional] if omitted the server will use the default value of False |
Return type
QueryResultResponse
Authorization
HTTPBearer
- Content-Type: Not defined
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Query data including paginated results if available |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
404 |
Query not found |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
get_query_results_csv
bool, date, datetime, dict, float, int, list, str, none_type get_query_results_csv(query_id)
Get query results in CSV format
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import QueryApi
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = QueryApi(api_client)
query_id = "57552f03-87af-4847-a83e-e46a320af0c2"
offset = 0 # (optional) if omitted the server will use the default value of 0
limit = 100 # (optional) if omitted the server will use the default value of 100
# example passing only required values which don't have defaults set
try:
# Get query results in CSV format
api_response = api_instance.get_query_results_csv(query_id)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->get_query_results_csv: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get query results in CSV format
api_response = api_instance.get_query_results_csv(query_id, offset=offset, limit=limit)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->get_query_results_csv: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
query_id |
str |
The unique identifier for the query |
|
offset |
int, none_type |
Starting index to return |
[optional] if omitted the server will use the default value of 0 |
limit |
int, none_type |
Max number of items to return |
[optional] if omitted the server will use the default value of 100 |
Return type
bool, date, datetime, dict, float, int, list, str, none_type
Authorization
HTTPBearer
- Content-Type: Not defined
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Query results as a CSV |
- |
403 |
Can only return CSV for completed queries |
- |
401 |
Unauthorized |
- |
404 |
Query not found |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]
stop_query_execution
QueryResponse stop_query_execution(query_id)
Stop query execution
Example
- Bearer Authentication (HTTPBearer):
| import time
import coactive
from coactive.apis import QueryApi
from coactive.model.query_response import QueryResponse
from coactive.model.http_validation_error import HTTPValidationError
from coactive.model.error_response import ErrorResponse
# Defining the host is optional and defaults to https://app.coactive.ai.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Example with auth is provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: HTTPBearer
# See configuration.py for a list of all supported configuration parameters.
from YOUR_ENV import CLIENT_ID, CLIENT_SECRET
configuration = coactive.Configuration(
host = "https://app.coactive.ai",
access_token = f"{CLIENT_ID}:{CLIENT_SECRET}",
)
# Enter a context with an instance of the API client
with coactive.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = QueryApi(api_client)
query_id = "57552f03-87af-4847-a83e-e46a320af0c2"
# example passing only required values which don't have defaults set
try:
# Stop query execution
api_response = api_instance.stop_query_execution(query_id)
print(api_response)
except coactive.ApiException as e:
print("Exception when calling QueryApi->stop_query_execution: %s\n" % e)
|
Parameters
Name |
Type |
Description |
Notes |
query_id |
str |
The unique identifier for the query |
|
Return type
QueryResponse
Authorization
HTTPBearer
- Content-Type: Not defined
- Accept: application/json
HTTP response details
Status code |
Description |
Response headers |
200 |
Query successfully stopped |
- |
403 |
Authentication error |
- |
401 |
Unauthorized |
- |
404 |
Query not found |
- |
422 |
Validation Error |
- |
[Back to top] [Back to API list] [Back to Model list] [Back to home]