Skip to main content

Python client for Cognica database

Project description

Cognica Python Client

A Python client for Cognica database server.

Installation

$ pip install cognica

Current Status

The current version is fully functional and stable for the production environment. However, the API is still subject to change and may break backward compatibility in the next release.

Current Version

import cognica

# Establish connection to a local database server.
channel = cognica.Channel("localhost", 10080)

# List collections.
db = cognica.DocumentDB(channel)
collections = db.list_collections()
for collection in collections:
    print(collection)

# Find a specific document in the Wikipedia collection.
collection = cognica.find_collection("Wikipedia")
df = collection.find({
    "page_id": 42
}, to_pandas=True)
print(df)

Next Version (Work in progress)

import cognica

# Establish connection to a local database server.
channel = cognica.Channel("localhost", 10080)

# Login to the database.
ws = cognica.Workspaces(channel, "user_id", "password")

# List workspaces.
workspaces = ws.list_workspaces()
for workspace in workspaces:
    print(workspace)

# Open the workspace and list the collections.
workspace = ws.find_workspace("test")
db = cognica.DocumentDB(workspace)
collections = db.list_collections()
for collection in collections:
    print(collection)

# Find a specific document in the Wikipedia collection.
collection = cognica.find_collection("Wikipedia")
df = collection.find({
    "page_id": 42
}, to_pandas=True)
print(df)

Project details


Download files

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

Source Distribution

cognica-0.1.13.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

cognica-0.1.13-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file cognica-0.1.13.tar.gz.

File metadata

  • Download URL: cognica-0.1.13.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cognica-0.1.13.tar.gz
Algorithm Hash digest
SHA256 902271b5d6be68ee11f9c379a509f1320f234481dff7535cbd5216e7efd1cfe1
MD5 0698a95a81fcd6d97d90a79b144b3be1
BLAKE2b-256 dad6e3b933504549d5ed54ddaa0cd38f9470c2699b61d15d3b1eeda2a0037f5f

See more details on using hashes here.

File details

Details for the file cognica-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: cognica-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for cognica-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d8b6df98a732196ea968b9b304e1c37b3529d5e27ed4d431b6ae9ba1baf9358c
MD5 3179f9afed33bceaba7ae57e68d26c3d
BLAKE2b-256 98602c739598897121f169e0fd6303d1acad00ec7704884ff56cb16712b43125

See more details on using hashes here.

Supported by

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