Skip to content

Latest commit

 

History

History
522 lines (359 loc) · 17.5 KB

File metadata and controls

522 lines (359 loc) · 17.5 KB

hotdata.DatabasesApi

All URIs are relative to https://api.hotdata.dev

Method HTTP request Description
attach_database_catalog POST /v1/databases/{database_id}/catalogs Attach catalog to database
create_database POST /v1/databases Create database
delete_database DELETE /v1/databases/{database_id} Delete database
detach_database_catalog DELETE /v1/databases/{database_id}/catalogs/{connection_id} Detach catalog from database
get_database GET /v1/databases/{database_id} Get database
list_databases GET /v1/databases List databases

attach_database_catalog

attach_database_catalog(database_id, attach_database_catalog_request)

Attach catalog to database

Attach an existing connection (catalog) to a database with an optional alias. Inside the database the catalog is reachable as the alias (when set) or its original name.

Example

  • Api Key Authentication (WorkspaceId):
  • Bearer Authentication (BearerAuth):
import hotdata
from hotdata.models.attach_database_catalog_request import AttachDatabaseCatalogRequest
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
    host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hotdata.DatabasesApi(api_client)
    database_id = 'database_id_example' # str | Database ID
    attach_database_catalog_request = hotdata.AttachDatabaseCatalogRequest() # AttachDatabaseCatalogRequest | 

    try:
        # Attach catalog to database
        api_instance.attach_database_catalog(database_id, attach_database_catalog_request)
    except Exception as e:
        print("Exception when calling DatabasesApi->attach_database_catalog: %s\n" % e)

Parameters

Name Type Description Notes
database_id str Database ID
attach_database_catalog_request AttachDatabaseCatalogRequest

Return type

void (empty response body)

Authorization

WorkspaceId, BearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Catalog attached -
400 Invalid request -
404 Database or connection not found -
409 Catalog already attached or alias collides with an existing attachment -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_database

CreateDatabaseResponse create_database(create_database_request)

Create database

Create a new database (a metadata-only grouping). A managed default catalog is auto-created and addressable inside the database as default, with a main schema pre-declared so default.main.<table> works out of the box. The optional name is a free-form display label and is not required to be unique. Optional schemas declares additional schemas/tables on the default catalog at create time; declared tables can be loaded via the standard managed-tables-load endpoint targeting default_connection_id. Optional expires_at sets when the database expires — accepts either an RFC 3339 timestamp or a relative duration suffixed with h (hours), m (minutes), or d (days), e.g. 24h, 48h, 90m, 7d. When omitted, the database never expires. Expiry is best-effort: the database will not be deleted before expires_at, but cleanup may run later than the exact timestamp. Optional storage_backend selects the physical backend for the default catalog — parquet (default) or ducklake (requires ducklake.metadata_pg_url to be configured).

Example

  • Api Key Authentication (WorkspaceId):
  • Bearer Authentication (BearerAuth):
import hotdata
from hotdata.models.create_database_request import CreateDatabaseRequest
from hotdata.models.create_database_response import CreateDatabaseResponse
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
    host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hotdata.DatabasesApi(api_client)
    create_database_request = hotdata.CreateDatabaseRequest() # CreateDatabaseRequest | 

    try:
        # Create database
        api_response = api_instance.create_database(create_database_request)
        print("The response of DatabasesApi->create_database:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->create_database: %s\n" % e)

Parameters

Name Type Description Notes
create_database_request CreateDatabaseRequest

Return type

CreateDatabaseResponse

Authorization

WorkspaceId, BearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Database created -
400 Invalid request -
500 Internal server error (e.g., managed-connection create succeeded but database row insert + rollback both failed) -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_database

delete_database(database_id)

Delete database

Delete a database and its auto-created default catalog. Attached catalogs are detached (their underlying connections are not deleted).

Example

  • Api Key Authentication (WorkspaceId):
  • Bearer Authentication (BearerAuth):
import hotdata
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
    host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hotdata.DatabasesApi(api_client)
    database_id = 'database_id_example' # str | Database ID

    try:
        # Delete database
        api_instance.delete_database(database_id)
    except Exception as e:
        print("Exception when calling DatabasesApi->delete_database: %s\n" % e)

Parameters

Name Type Description Notes
database_id str Database ID

Return type

void (empty response body)

Authorization

WorkspaceId, BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Database deleted -
404 Database not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

detach_database_catalog

detach_database_catalog(database_id, connection_id)

Detach catalog from database

Example

  • Api Key Authentication (WorkspaceId):
  • Bearer Authentication (BearerAuth):
import hotdata
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
    host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hotdata.DatabasesApi(api_client)
    database_id = 'database_id_example' # str | Database ID
    connection_id = 'connection_id_example' # str | Connection ID

    try:
        # Detach catalog from database
        api_instance.detach_database_catalog(database_id, connection_id)
    except Exception as e:
        print("Exception when calling DatabasesApi->detach_database_catalog: %s\n" % e)

Parameters

Name Type Description Notes
database_id str Database ID
connection_id str Connection ID

Return type

void (empty response body)

Authorization

WorkspaceId, BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Catalog detached -
400 Cannot detach a database's own default catalog -
404 Database or attachment not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_database

DatabaseDetailResponse get_database(database_id)

Get database

Fetch a database by id. The name field is a display label only; it is not accepted as an identifier here.

Example

  • Api Key Authentication (WorkspaceId):
  • Bearer Authentication (BearerAuth):
import hotdata
from hotdata.models.database_detail_response import DatabaseDetailResponse
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
    host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hotdata.DatabasesApi(api_client)
    database_id = 'database_id_example' # str | Database ID

    try:
        # Get database
        api_response = api_instance.get_database(database_id)
        print("The response of DatabasesApi->get_database:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->get_database: %s\n" % e)

Parameters

Name Type Description Notes
database_id str Database ID

Return type

DatabaseDetailResponse

Authorization

WorkspaceId, BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Database details -
404 Database not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_databases

ListDatabasesResponse list_databases()

List databases

Example

  • Api Key Authentication (WorkspaceId):
  • Bearer Authentication (BearerAuth):
import hotdata
from hotdata.models.list_databases_response import ListDatabasesResponse
from hotdata.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.hotdata.dev
# See configuration.py for a list of all supported configuration parameters.
configuration = hotdata.Configuration(
    host = "https://api.hotdata.dev"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: WorkspaceId
configuration.api_key['WorkspaceId'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['WorkspaceId'] = 'Bearer'

# Configure Bearer authorization: BearerAuth
configuration = hotdata.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with hotdata.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hotdata.DatabasesApi(api_client)

    try:
        # List databases
        api_response = api_instance.list_databases()
        print("The response of DatabasesApi->list_databases:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DatabasesApi->list_databases: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

ListDatabasesResponse

Authorization

WorkspaceId, BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of databases -

[Back to top] [Back to API list] [Back to Model list] [Back to README]