Registry / aws / cassandra-sigv4

cassandra-sigv4

JSON →
library4.0.2pypypi✓ verified 86d ago

Implements a SigV4 authentication plugin for the open-source DataStax Python Driver for Apache Cassandra, enabling connections to Amazon Keyspaces or other Cassandra clusters that require IAM-based authentication. Current version 4.0.2, release cadence is intermittent.

pip install cassandra-sigv4
INSTALL
IMPORT
SIG · CASSANDRA-SIGV4
C
cassandra-sigv4
awspythonv4.0.2
Install
4.5s avg
Import
640ms
Disk
83MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 5.2s
py 3.11
✕ build_error
✓ 4.6s
py 3.12
✕ build_error
✓ 4s
py 3.13
✕ build_error
✓ 3.7s
py 3.9
✓ —
✓ 5.1s
83MB installed
● package 83MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SigV4AuthProvider
from cassandra_sigv4.auth import SigV4AuthProvider
from cassandra_sigv4 import SigV4AuthProvider
In older versions the symbol was at package level, but since 4.0.0 it moved to a submodule. The old import will raise ImportError.
boto3
import boto3

Connects to Amazon Keyspaces using SigV4 authentication. Ensure AWS credentials are available via environment, IAM role, or boto3 session.

import boto3 from cassandra.cluster import Cluster from cassandra_sigv4.auth import SigV4AuthProvider # AWS credentials (region is required; credentials from env or boto3 session) boto_session = boto3.Session() auth_provider = SigV4AuthProvider(boto_session=boto_session) cluster = Cluster( ['cassandra.<region>.amazonaws.com'], port=9142, ssl_context=True, auth_provider=auth_provider ) session = cluster.connect() row = session.execute('SELECT keyspace_name FROM system_schema.keyspaces').one() print(row) # Expected: first keyspace session.shutdown() cluster.shutdown()
Debug
Known issues
gotchaThe auth_provider must be passed to the Cluster constructor, not set via session or after connection.
fix
Set auth_provider in Cluster(...) call, not after.
affects: All
breakingIn version 4.0.0, the import path changed. The class SigV4AuthProvider is no longer importable from the top-level package; use from cassandra_sigv4.auth import SigV4AuthProvider.
fix
Update imports to from cassandra_sigv4.auth import SigV4AuthProvider.
affects: >=4.0.0
gotchaThe plugin requires Python 2.7 or 3.x (requires_python >=2.7, <4). It has been tested primarily with Python 3.6+. Older Python 2.7 usage may have compatibility issues with newer versions of cassandra-driver.
fix
Use Python 3.6+ and ensure cassandra-driver version is compatible.
affects: All
gotchaThe region must be set either via boto3 session, environment variable AWS_DEFAULT_REGION, or the keyspace endpoint hostname. Missing region will cause authentication failure.
fix
Set AWS_DEFAULT_REGION or pass a boto3 session with explicit region.
affects: All
Errors
Common errors & fixes
cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'<host>:9142': ConnectionException('Failed to connect')})
SSL context not enabled or incorrect port. Amazon Keyspaces requires SSL on port 9142.
fix
Set ssl_context=True and port=9142 in Cluster constructor.
AttributeError: module 'cassandra_sigv4' has no attribute 'SigV4AuthProvider'
Import path changed in version 4.0.0. The class moved to a submodule.
fix
Use 'from cassandra_sigv4.auth import SigV4AuthProvider' instead of 'from cassandra_sigv4 import SigV4AuthProvider'.
TypeError: __init__() missing 1 required keyword-only argument: 'boto_session'
SigV4AuthProvider requires boto_session or other parameters (like credentials) in newer versions.
fix
Pass a boto3.Session object: SigV4AuthProvider(boto_session=boto3.Session())
boto3.exceptions.NoRegionError: You must specify a region.
No AWS region configured. The plugin needs a region from environment, boto session, or hostname.
fix
Set AWS_DEFAULT_REGION environment variable, or create boto3 session with region_name='us-east-1'.
Upgrade
Version history
4.0.2latest on PyPI · released Oct 30, 2020
Audit
Dependencies
cassandra-driverrequiredRequired runtime dependency: this plugin is an authentication provider for the DataStax Python driver.
boto3optionalUsed to obtain AWS credentials and region. Required unless custom credentials are provided.
Agent activity
31 hits · last 30 days
node
30
OpenAI (training)
1
Resources