Skip to main content

AstraPy is a Pythonic SDK for DataStax Astra

Project description

AstraPy

Actions Status

AstraPy is a Pythonic SDK for DataStax Astra and Stargate

Resources

Getting Started

Install AstraPy

pip install astrapy

Setup your Astra client

Create a .env file with the appropriate values, or use the 'astra' cli to do the same.

ASTRA_DB_KEYSPACE="<keyspace>"
ASTRA_DB_APPLICATION_TOKEN="<AstraCS:...>"
ASTRA_DB_REGION="<region>"
ASTRA_DB_ID=<db_id>

Load the variables in and then create the client. This collections client can make non-vector and vector calls, depending on the call configuration.

from astrapy.collections import AstraCollectionClient
from astrapy.base import AstraClient

from dotenv import load_dotenv

load_dotenv()

ASTRA_DB_ID = os.environ.get("ASTRA_DB_ID")
ASTRA_DB_REGION = os.environ.get("ASTRA_DB_REGION")
ASTRA_DB_APPLICATION_TOKEN = os.environ.get("ASTRA_DB_APPLICATION_TOKEN")
ASTRA_DB_KEYSPACE = os.environ.get("ASTRA_DB_KEYSPACE")
TEST_COLLECTION_NAME = "test_collection"

astra_client = AstraClient(
        astra_database_id=ASTRA_DB_ID,
        astra_database_region=ASTRA_DB_REGION,
        astra_application_token=ASTRA_DB_APPLICATION_TOKEN,
    )

vector_client = AstraVectorClient(astra_client=astra_client)
test_namespace = vector_client.namespace(ASTRA_DB_KEYSPACE)
test_collection = vector_client.namespace(ASTRA_DB_KEYSPACE).collection(TEST_COLLECTION_NAME)

####Getting started Check out the notebook which has examples for finding and inserting information into the database, including vector commands.

Take a look at the vector tests and the collection tests for specific endpoint examples.

Using the Ops Client

You can use the Ops client to work the with Astra DevOps API. Check the devops tests

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

astrapy-0.5.0.dev3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

astrapy-0.5.0.dev3-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file astrapy-0.5.0.dev3.tar.gz.

File metadata

  • Download URL: astrapy-0.5.0.dev3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for astrapy-0.5.0.dev3.tar.gz
Algorithm Hash digest
SHA256 a26401fe4863378af506a103c93dbbf4fc3db8d5bd4a3694b396ec5b986c15c4
MD5 d1b70cce278e21b588986780be935f6a
BLAKE2b-256 e32354cbdf2ce7de2c5f82cd966ac7b8d7662c343930f929432e02a39ad71f97

See more details on using hashes here.

File details

Details for the file astrapy-0.5.0.dev3-py3-none-any.whl.

File metadata

  • Download URL: astrapy-0.5.0.dev3-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for astrapy-0.5.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 dd2a290c677f5b8533e5577f2ae0681b2db4bc2cb102c10641071731edc961c2
MD5 55a451e5b2bdd5bbcb82c2194031f0cf
BLAKE2b-256 4bb581149c02640821851ec8c72d731b48485aaf3fad59a49cec06e250f9d98b

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