Skip to main content

Python client library for Aquila Network

Project description


Python client library for Aquila Network


pip install aquilapy


from aquilapy import Wallet, DB, Hub
import numpy as np
import time

# Create a wallet instance from private key
wallet = Wallet("private_unencrypted.pem")

host = ""

# Connect to Aquila DB instance
db = DB(host, "5001", wallet)

# Connect to Aquila Hub instance
hub = Hub(host, "5002", wallet)

# Schema definition to be used
schema_def = {
    "description": "this is my database",
    "unique": "r8and0mseEd901",
    "encoder": "ftxt:",
    "codelen": 25,
    "metadata": {
        "name": "string",
        "age": "number"

# Craete a database with the schema definition provided
db_name = db.create_database(schema_def)

# Craete a database with the schema definition provided
db_name_ = hub.create_database(schema_def)

print(db_name, db_name_)

# Generate encodings
texts = ["Amazon", "Google"]
compression = hub.compress_documents(db_name, texts)

# Prepare documents to be inserted
docs = [{
    "metadata": {
        "age": 20
    "code": compression[0]
}, {
        "metadata": {
        "age": 30
    "code": compression[1]

# Insert documents
dids = db.insert_documents(db_name, docs)


# Delete some documents
dids = db.delete_documents(db_name, dids)


# Perform a similarity search operation
matrix = np.random.rand(1, 25).tolist()


docs, dists = db.search_k_documents(db_name, matrix, 10)

print(len(docs[0]), len(dists[0]))

created with ❤️ a-mma.indic (a_മ്മ)

Project details

Download files

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

Files for aquilapy, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size aquilapy-0.3.1-py3-none-any.whl (5.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aquilapy-0.3.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page