Skip to main content

Provides access to the Waii APIs

Project description

Waii Python SDK

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

Waii Python SDK depends on pydantic, but to avoid it conflicting with other libraries, it is not included in the dependencies. You can install it separately:

You can either install v1.10.15+

pip install pydantic==1.10.15

Or 2.7.1+

pip install pydantic==2.7.1

Importing & Initialize the SDK

>>> from waii_sdk_py import WAII
>>> from waii_sdk_py.query import *
>>> WAII.initialize(api_key="<your-api-key>")
>>> print(WAII.version()) # Check the version of the SDK

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 Database name of the active connection

>>> print([catalog.name for catalog in WAII.Database.get_catalogs().catalogs])
>>> print(WAII.Query.generate(QueryGenerationRequest(ask = "How many tables are there?")).query)

SELECT COUNT(DISTINCT table_name)
FROM waii.information_schema.tables

Run the query

>>> print(WAII.Query.run(RunQueryRequest(query = "SELECT COUNT(DISTINCT table_name) FROM waii.information_schema.tables")))

rows=[{'COUNT(DISTINCT TABLE_NAME)': 112}] more_rows=0 column_definitions=[ColumnDefinition(name='COUNT(DISTINCT TABLE_NAME)', type='FIXED')] query_uuid='01afbd1e-0001-d31e-0022-ba8700a8209e'

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.29.1.tar.gz (38.1 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.29.1-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

Details for the file waii_sdk_py-1.29.1.tar.gz.

File metadata

  • Download URL: waii_sdk_py-1.29.1.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.9

File hashes

Hashes for waii_sdk_py-1.29.1.tar.gz
Algorithm Hash digest
SHA256 90afbe4524d4bd20a4036b032a96121bf3991c5959c589cba7e2b3e5b0032416
MD5 1f24f157ce2493a4e726cb049f7d43b3
BLAKE2b-256 2feb8f285fb93ada2b364e7054f3ef733c988aa471785339e8bf833f618cef3c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: waii_sdk_py-1.29.1-py3-none-any.whl
  • Upload date:
  • Size: 50.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.9

File hashes

Hashes for waii_sdk_py-1.29.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9da962ad093d56c711ec97c0a70dd99d849f608b8d7962b0cd6af2b6b59d9f19
MD5 a0fa4ea4999336c5806eec343611a8df
BLAKE2b-256 5feeb6395f7a5a0471ebf882b0e6f6a15eb1d7126e4542ccf7dd2b27f24a26e2

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