Skip to content

Latest commit

 

History

History
 
 

python

polaris.catalog

Defines the specification for the first version of the REST Catalog API. Implementations should ideally support both Iceberg table specs v1 and v2, with priority given to v2.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.0.1
  • Package version: 1.0.0
  • Generator version: 7.8.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import polaris.catalog

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import polaris.catalog

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import polaris.catalog
from polaris.catalog.rest import ApiException
from pprint import pprint

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

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

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


# Enter a context with an instance of the API client
with polaris.catalog.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = polaris.catalog.IcebergCatalogAPI(api_client)
    prefix = 'prefix_example' # str | An optional prefix in the path
    commit_transaction_request = polaris.catalog.CommitTransactionRequest() # CommitTransactionRequest | Commit updates to multiple tables in an atomic operation  A commit for a single table consists of a table identifier with requirements and updates. Requirements are assertions that will be validated before attempting to make and commit changes. For example, `assert-ref-snapshot-id` will check that a named ref's snapshot ID has a certain value.  Updates are changes to make to table metadata. For example, after asserting that the current main ref is at the expected snapshot, a commit may add a new child snapshot and set the ref to the new snapshot id.

    try:
        # Commit updates to multiple tables in an atomic operation
        api_instance.commit_transaction(prefix, commit_transaction_request)
    except ApiException as e:
        print("Exception when calling IcebergCatalogAPI->commit_transaction: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://localhost

Class Method HTTP request Description
IcebergCatalogAPI commit_transaction POST /v1/{prefix}/transactions/commit Commit updates to multiple tables in an atomic operation
IcebergCatalogAPI create_namespace POST /v1/{prefix}/namespaces Create a namespace
IcebergCatalogAPI create_table POST /v1/{prefix}/namespaces/{namespace}/tables Create a table in the given namespace
IcebergCatalogAPI create_view POST /v1/{prefix}/namespaces/{namespace}/views Create a view in the given namespace
IcebergCatalogAPI drop_namespace DELETE /v1/{prefix}/namespaces/{namespace} Drop a namespace from the catalog. Namespace must be empty.
IcebergCatalogAPI drop_table DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table} Drop a table from the catalog
IcebergCatalogAPI drop_view DELETE /v1/{prefix}/namespaces/{namespace}/views/{view} Drop a view from the catalog
IcebergCatalogAPI list_namespaces GET /v1/{prefix}/namespaces List namespaces, optionally providing a parent namespace to list underneath
IcebergCatalogAPI list_tables GET /v1/{prefix}/namespaces/{namespace}/tables List all table identifiers underneath a given namespace
IcebergCatalogAPI list_views GET /v1/{prefix}/namespaces/{namespace}/views List all view identifiers underneath a given namespace
IcebergCatalogAPI load_namespace_metadata GET /v1/{prefix}/namespaces/{namespace} Load the metadata properties for a namespace
IcebergCatalogAPI load_table GET /v1/{prefix}/namespaces/{namespace}/tables/{table} Load a table from the catalog
IcebergCatalogAPI load_view GET /v1/{prefix}/namespaces/{namespace}/views/{view} Load a view from the catalog
IcebergCatalogAPI namespace_exists HEAD /v1/{prefix}/namespaces/{namespace} Check if a namespace exists
IcebergCatalogAPI register_table POST /v1/{prefix}/namespaces/{namespace}/register Register a table in the given namespace using given metadata file location
IcebergCatalogAPI rename_table POST /v1/{prefix}/tables/rename Rename a table from its current name to a new name
IcebergCatalogAPI rename_view POST /v1/{prefix}/views/rename Rename a view from its current name to a new name
IcebergCatalogAPI replace_view POST /v1/{prefix}/namespaces/{namespace}/views/{view} Replace a view
IcebergCatalogAPI report_metrics POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics Send a metrics report to this endpoint to be processed by the backend
IcebergCatalogAPI send_notification POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/notifications Sends a notification to the table
IcebergCatalogAPI table_exists HEAD /v1/{prefix}/namespaces/{namespace}/tables/{table} Check if a table exists
IcebergCatalogAPI update_properties POST /v1/{prefix}/namespaces/{namespace}/properties Set or remove properties on a namespace
IcebergCatalogAPI update_table POST /v1/{prefix}/namespaces/{namespace}/tables/{table} Commit updates to a table
IcebergCatalogAPI view_exists HEAD /v1/{prefix}/namespaces/{namespace}/views/{view} Check if a view exists
IcebergConfigurationAPI get_config GET /v1/config List all catalog configuration settings
IcebergOAuth2API get_token POST /v1/oauth/tokens Get a token using an OAuth2 flow

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

OAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • catalog: Allows interacting with the Config and Catalog APIs

BearerAuth

  • Type: Bearer authentication

Author