Skip to main content

Cassandra Query Language driver

Project description

A Python driver for CQL that adheres to py-dbapi v2
(PEP249, Python Database API Specification v2.0: http://www.python.org/dev/peps/pep-0249/).

Standard use:
>> import cql
>> con = cql.connect(host, port, keyspace)
>> cursor = con.cursor()
>> cursor.execute("CQL QUERY", {kw=Foo, kw2=Bar, etc...})

- cursor.description # None initially, list of N tuples that represent
the N columns in a row after an execute. Only
contains type and name info, not values.
- cursor.rowcount # -1 initially, N after an execute
- cursor.arraysize # variable size of a fetchmany call
- cursor.fetchone() # returns a single row
- cursor.fetchmany() # returns self.arraysize # of rows
- cursor.fetchall() # returns all rows, don't do this.

>> cursor.execute("ANOTHER QUERY", **more_kwargs)
>> for row in cursor: # Iteration is equivalent to lots of fetchone() calls
>> doRowMagic(row)

>> cursor.close()
>> con.close()

Query substitution:
- Use named parameters and a dictionary of names and values.
e.g. execute("SELECT * FROM CF WHERE name=:name", name="Foo")

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

cql-1.0.7.tar.gz (47.8 kB view details)

Uploaded Source

File details

Details for the file cql-1.0.7.tar.gz.

File metadata

  • Download URL: cql-1.0.7.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cql-1.0.7.tar.gz
Algorithm Hash digest
SHA256 c2343bfacefa738b5a7bbdbb1f91d5ee52979f66aaff19445adb63757622a383
MD5 ebeb85a709284cb49101e173fbab9ee7
BLAKE2b-256 5db8228b0ef245400505f644844ed60dd81d374cb1718557641106b3e0b38dcf

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page