{"id":5472,"library":"scylla-driver","title":"Scylla Driver for Apache Cassandra","description":"The Scylla Python Driver is a modern, feature-rich, and highly-tunable Python client library designed for Scylla Open Source (2.1+), Apache Cassandra (2.1+), and Scylla Enterprise (2018.1.x+). It exclusively uses Cassandra's binary protocol and Cassandra Query Language v3. The driver, currently at version 3.29.9, offers synchronous and asynchronous APIs, connection pooling, automatic node discovery, and includes an integrated object mapper (cqlengine). It maintains an active release cadence with frequent updates.","status":"active","version":"3.29.9","language":"en","source_language":"en","source_url":"https://github.com/scylladb/python-driver/","tags":["database","cassandra","scylladb","nosql","driver","async"],"install":[{"cmd":"pip install scylla-driver","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for DSE geo types support, a dependency after the core and DSE drivers were merged.","package":"geomet","optional":false},{"reason":"A core dependency listed in pyproject.toml.","package":"pyyaml","optional":false},{"reason":"Optional dependency for the fluent graph API.","package":"gremlinpython","optional":true},{"reason":"Optional dependency for 'cle' features.","package":"cryptography","optional":true},{"reason":"Optional dependency for LZ4 compression support.","package":"lz4","optional":true},{"reason":"Optional dependency for Snappy compression support.","package":"python-snappy","optional":true},{"reason":"Optional dependency for Kerberos authentication (non-Windows).","package":"kerberos","optional":true},{"reason":"Optional dependency for Kerberos authentication (Windows).","package":"winkerberos","optional":true}],"imports":[{"note":"The Scylla driver uses the 'cassandra' namespace for its core components, even though the package is installed as 'scylla-driver'. This can be a common point of confusion for new users.","wrong":"from scylla_driver.cluster import Cluster","symbol":"Cluster","correct":"from cassandra.cluster import Cluster"},{"note":"Session objects are created from a Cluster instance.","symbol":"Session","correct":"from cassandra.cluster import Cluster; session = cluster.connect()"},{"note":"Used for plain-text username/password authentication.","symbol":"PlainTextAuthProvider","correct":"from cassandra.auth import PlainTextAuthProvider"}],"quickstart":{"code":"import os\nfrom cassandra.cluster import Cluster\nfrom cassandra.auth import PlainTextAuthProvider\n\n# Replace with your ScyllaDB/Cassandra contact points and credentials\nCONTACT_POINTS = os.environ.get('SCYLLA_CONTACT_POINTS', '127.0.0.1').split(',')\nUSERNAME = os.environ.get('SCYLLA_USERNAME', 'scylla')\nPASSWORD = os.environ.get('SCYLLA_PASSWORD', 'password')\n\nauth_provider = PlainTextAuthProvider(username=USERNAME, password=PASSWORD)\n\ncluster = None\nsession = None\ntry:\n    cluster = Cluster(contact_points=CONTACT_POINTS, auth_provider=auth_provider)\n    session = cluster.connect()\n\n    # Example: Create a keyspace and table (if they don't exist)\n    session.execute(\n        \"\"\"CREATE KEYSPACE IF NOT EXISTS mykeyspace WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': 1}\"\"\"\n    )\n    session.set_keyspace('mykeyspace')\n    session.execute(\n        \"\"\"CREATE TABLE IF NOT EXISTS users (id UUID PRIMARY KEY, name text, email text)\"\"\"\n    )\n\n    # Example: Insert data\n    user_id = session.execute(\"SELECT uuid() FROM system.local\").one()[0]\n    session.execute(\n        \"\"\"INSERT INTO users (id, name, email) VALUES (%s, %s, %s)\"\"\",\n        (user_id, \"Alice\", \"alice@example.com\")\n    )\n    print(f\"Inserted user: {user_id}\")\n\n    # Example: Select data\n    rows = session.execute(\"SELECT id, name, email FROM users WHERE id = %s\", (user_id,))\n    for row in rows:\n        print(f\"Retrieved user: {row.id}, {row.name}, {row.email}\")\n\nfinally:\n    if session:\n        session.shutdown()\n    if cluster:\n        cluster.shutdown()","lang":"python","description":"This quickstart demonstrates how to establish a connection to a ScyllaDB or Cassandra cluster, create a keyspace and table, insert data, and retrieve it. It uses environment variables for credentials, suitable for secure deployment."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer for full compatibility and support.","message":"Python 3.8 and 3.9 are no longer officially supported by the driver as of recent versions (e.g., 3.29.5 dropped Python 3.9, 3.29.4 dropped Python 3.8). While PyPI metadata indicates `>=3.9`, the official documentation states support for Python 3.10-3.14.","severity":"breaking","affected_versions":">=3.29.4"},{"fix":"Ensure your ScyllaDB or Cassandra cluster supports native protocol version 3 or higher. Most modern deployments will already meet this requirement.","message":"Support for Cassandra native protocol versions 1 and 2 has been removed. Connections to very old ScyllaDB or Apache Cassandra clusters that only support these protocols will fail.","severity":"breaking","affected_versions":">=3.29.4"},{"fix":"If encountering build issues, ensure your `pip` is up-to-date and your environment correctly handles PEP 517 builds. Avoid using `--no-build-isolation` if you are not managing build dependencies manually.","message":"The driver's build system has moved from `setup_requires` to PEP 517. While this improves modern Python packaging, it might affect users with custom or older build environments if they were relying on `setup_requires` behavior.","severity":"gotcha","affected_versions":">=3.29.9"},{"fix":"For Python 3.12 and later, explicitly configure a supported event loop for the driver, e.g., by installing `libev` (`pip install pyuv`) or `gevent` (`pip install gevent`) and configuring the cluster to use it.","message":"The default event loop in Python versions prior to 3.12 utilized `asyncore`. With `asyncore` being removed entirely in Python 3.12, users must explicitly configure an alternative event loop like `libev`, `gevent`, or `eventlet` when running on Python 3.12+ if they relied on the default.","severity":"gotcha","affected_versions":">=3.29.0 (for Python 3.12+ users)"},{"fix":"Instead of `Session.default_consistency_level`, specify the consistency level per statement or through Execution Profiles for better control and future compatibility.","message":"The `Session.default_consistency_level` attribute is deprecated. Relying on this attribute may lead to future compatibility issues.","severity":"deprecated","affected_versions":">=3.29.8"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}