Skip to main content

Provides access to the Waii APIs

Project description

Waii Python SDK Documentation

The waii-sdk-py is a Python library that allows you to interact with the Waii API. It provides a powerful SQL and AI capability to your Python applications.

Installation

To install the waii-sdk-py, you can use pip:

pip install waii-sdk-py

Importing & Initialize the SDK

from waii_sdk_py import WAII
WAII.initialize(api_key="<your-api-key>")

You can get your API key from the tweakit.waii.ai (You need to register and get access from waii.ai first).

img.png

Get started

First you can print the list of available databases:

print([conn.key for conn in WAII.Database.get_connections().connectors])

Then, you can activate the database connection you want to use (from one of the key in the list above)

WAII.Database.activate_connection("snowflake://...&warehouse=COMPUTE_WH")

Get the list of available catalogs:

print([catalog.name for catalog in WAII.Database.get_catalogs().catalogs])

Modules

The SDK consists of the following modules:

  • Database
  • Query
  • SemanticContext
  • History

Each module encapsulates a certain functionality of the Waii API.

Database

The Database module contains methods for handling database-related tasks.

Here are some of its methods:

Modify Connections

Database.modify_connections(params: ModifyDBConnectionRequest) -> ModifyDBConnectionResponse

This method allows to modify the database connections.

Get Connections

Database.get_connections(params: GetDBConnectionRequest = GetDBConnectionRequest()) -> GetDBConnectionResponse

This method fetches the list of available database connections.

Activate Connection

Database.activate_connection(key: str)

This method sets the scope of the current database connection.

Get Default Connection

Database.get_default_connection()

This method gets the scope of the current database connection.

Get Catalogs

Database.get_catalogs(params: GetCatalogRequest = GetCatalogRequest()) -> GetCatalogResponse

This method retrieves the list of available catalogs.

Update Table and Schema Descriptions

Database.update_table_description(params: UpdateTableDescriptionRequest) -> UpdateTableDescriptionResponse
Database.update_schema_description(params: UpdateSchemaDescriptionRequest) -> UpdateSchemaDescriptionResponse

These methods update the corresponding descriptions of the objects within the database

Query

The Query module contains methods related to SQL query handling.

Here are some of its methods:

Generate

Query.generate(params: QueryGenerationRequest) -> GeneratedQuery

This method generates a SQL query based on the provided parameters.

Run

Query.run(params: RunQueryRequest) -> GetQueryResultResponse

This method runs a SQL query and fetches the results.

Like

Query.like(params: LikeQueryRequest) -> LikeQueryResponse

This method marks a query as "liked".

Submit

Query.submit(params: RunQueryRequest) -> RunQueryResponse

This method submits a SQL query.

Get Results

Query.get_results(params: GetQueryResultRequest) -> GetQueryResultResponse

This method fetches the result of a previously submitted query.

Cancel

Query.cancel(params: CancelQueryRequest) -> CancelQueryResponse

This method cancels a previously submitted query.

Describe

Query.describe(params: DescribeQueryRequest) -> DescribeQueryResponse

This method fetches a description of a SQL query.

Diff

Query.diff(params: DiffQueryRequest) -> DiffQueryResponse

This method generates a description of the difference between two SQL queries

Auto Complete

Query.auto_complete(params: AutoCompleteRequest) -> AutoCompleteResponse

This method allows you to automatically complete a partial query

Analyze Performance

Query.analyze_performance(params: QueryPerformanceRequest) -> QueryPerformanceResponse

This method provides a summary of the runtime of a query as well as recommendations on how to make the query run faster

Semantic Context

The SemanticContext module contains methods related to semantic context handling.

Here are some of its methods:

Modify Semantic Context

SemanticContext.modify_semantic_context(params: ModifySemanticContextRequest) -> ModifySemanticContextResponse

This method allows you to modify the semantic context.

Get Semantic Context

SemanticContext.get_semantic_context(params: GetSemanticContextRequest = GetSemanticContextRequest()) -> GetSemanticContextResponse

This method fetches the current semantic context.

History

The History module contains methods related to history handling.

Here are some of its methods:

List

History.list(params: GetGeneratedQueryHistoryRequest = GetGeneratedQueryHistoryRequest()) -> GetGeneratedQueryHistoryResponse

This method fetches the history of generated queries.

For detailed information about the request and response objects and the available properties, refer to the respective Python files of each module.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waii-sdk-py-1.7.2.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waii_sdk_py-1.7.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file waii-sdk-py-1.7.2.tar.gz.

File metadata

  • Download URL: waii-sdk-py-1.7.2.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for waii-sdk-py-1.7.2.tar.gz
Algorithm Hash digest
SHA256 7bb6873caa71547a118f7c50dfbc80189f1527e2537cc53fa1694d535dab247a
MD5 da5fe906865f456ee7e05ec2daefebba
BLAKE2b-256 fc7e787931fcfec3862a29041bbe9120f5d2ca9d94b6e6834b1457a62ac848d5

See more details on using hashes here.

File details

Details for the file waii_sdk_py-1.7.2-py3-none-any.whl.

File metadata

  • Download URL: waii_sdk_py-1.7.2-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for waii_sdk_py-1.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f142b1915ccb1d8b05b7aa9356db3a00ed16716aabf4de34353511c554b6012d
MD5 027b50c3fe102ccb5ebe48ff826c29d6
BLAKE2b-256 d8ed6243cdf9eef0dcee7971b7bed3aab9e7bb879febd12cf5314a66e3faceae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page