AquilaDB-Python
Python client library for Aquila Network
install
pip install aquilapy
Tutorial
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 = "http://127.0.0.1"
# 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:https://ftxt-models.s3.us-east-2.amazonaws.com/ftxt_base_min.bin",
"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)
print(compression)
# Prepare documents to be inserted
docs = [{
"metadata": {
"name":"name1",
"age": 20
},
"code": compression[0]
}, {
"metadata": {
"name":"name2",
"age": 30
},
"code": compression[1]
}]
# Insert documents
dids = db.insert_documents(db_name, docs)
print(dids)
# Delete some documents
dids = db.delete_documents(db_name, dids)
print(dids)
# Perform a similarity search operation
matrix = np.random.rand(1, 25).tolist()
time.sleep(5)
docs, dists = db.search_k_documents(db_name, matrix, 10)
print(len(docs[0]), len(dists[0]))
created with ❤️ a-mma.indic (a_മ്മ)
Metadata
Release files for aquilapy 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aquilapy-0.3.1.tar.gz | 3.7 kB | Without provenance | Details for aquilapy-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aquilapy-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for aquilapy-0.3.1-py3-none-any.whl |
Total release size: 9.4 kB
Release files / aquilapy-0.3.1.tar.gz
| Download URL | aquilapy-0.3.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9703574063ffc4cd3ab146c75843391794048fe0c8f630f37daeca1407d60fce
|
|
BLAKE2b-256 checksum How to use checksums |
7e92c3f112290df46c9daedccbbf5f3d6eb524e0ced376575784ab6b1cc7b0d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2
|
Release files / aquilapy-0.3.1-py3-none-any.whl
| Download URL | aquilapy-0.3.1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b94c2411a97601f2f6848313cbcf2cb64705e93c8c25385c464cd84c6c230a8
|
|
BLAKE2b-256 checksum How to use checksums |
ff4fb49e6518737e3138af10cbc9b2fe36de07a191f1f3958aefb48337bb7881
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2
|
Security for aquilapy 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.