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 = db.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 = db.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.17.tar.gz (34.6 kB view details)

Uploaded Source

Built Distribution

cognica-0.1.17-py3-none-any.whl (45.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cognica-0.1.17.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for cognica-0.1.17.tar.gz
Algorithm Hash digest
SHA256 9119733d9d68587a1355846661d9a7fc84e36f5efbb98e211158fe23419cc23f
MD5 22145c4b9ff3dbdec9592e26fda95891
BLAKE2b-256 8e770bc4708aad309b0d8e4b5f048d2ab6506baff28d4a26d48530d3b8f1c54c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cognica-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 45.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for cognica-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 5025033f4c18409d91b05dfc036dbad91baf14176b4e72038cfdc7297f3fc26f
MD5 b08b0087e34ad1b33649372ade6dbd8e
BLAKE2b-256 993c6133cc1964b0468ded0e29d0b5a5c013c06a2f608a5050d0ac95e03f4a22

See more details on using hashes here.

Supported by

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