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).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waii_sdk_py-1.14.2.tar.gz.
File metadata
- Download URL: waii_sdk_py-1.14.2.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08cf3a25c83a85b12b0b10c97edf14aa90cda714aa5c63695391a66d0b2c45a7
|
|
| MD5 |
ca4c35810d9fbae852b46864a6cb4580
|
|
| BLAKE2b-256 |
0b012311f16157255a01d04b7d6cae8b1d911b8c5d8d4fe4e66037050280d7da
|
File details
Details for the file waii_sdk_py-1.14.2-py3-none-any.whl.
File metadata
- Download URL: waii_sdk_py-1.14.2-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3a9f0cd19674a4fc1c2e5fb286c4e4bf15545ecf4fccb626385f8a28bcd1ef
|
|
| MD5 |
8aa97c9a9659ec208d03986f35fc2525
|
|
| BLAKE2b-256 |
41231192a3c02c2acd63965ac1e38009b879c8995e32b4403b45c9520cdfdbf3
|