Skip to content

Instantly share code, notes, and snippets.

@stuart-warren
Last active December 19, 2015 02:29
Show Gist options
  • Select an option

  • Save stuart-warren/5883255 to your computer and use it in GitHub Desktop.

Select an option

Save stuart-warren/5883255 to your computer and use it in GitHub Desktop.
Use FPM to create a deb for python-cql (Cassandra CQL 3 driver)
#!/bin/bash
APP='python-cql'
# VERSION=1.4.0 # I assume this is worked out itself?
ITERATION='1'
# -v $VERSION \
rm -f ${APP}_*_all.deb
fpm \
-n $APP \
--iteration ${ITERATION} \
-a all \
-C $APP \
-m "Cassandra DBAPI-2 Driver Team <client-dev@cassandra.apache.org>" \
--description "A Python driver for CQL that adheres to py-dbapi v2" \
--url 'http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2' \
--license 'Apache License, Version 2.0' \
-d 'python-thrift' \
-t deb \
-s python \
cql
#!/bin/bash
APP='python-thrift'
ITERATION='1'
# -v $VERSION \
rm -f ${APP}_*_all.deb
fpm \
-n $APP \
--iteration ${ITERATION} \
-a all \
-C $APP \
-m "Thrift Developers <dev@thrift.apache.org>" \
--description "Python bindings for the Apache Thrift RPC system" \
--url 'http://thrift.apache.org' \
--license 'Apache License, Version 2.0' \
-d 'python-thrift' \
-t deb \
-s python \
thrift
@stuart-warren
Copy link
Copy Markdown
Author

sudo apt-get install python-cql #(https://gist.github.com/stuart-warren/5883255)
python
import cql
con = cql.connect('hostname', 9160, 'system_auth', 'username', 'password', '3.0.0')
cursor = con.cursor()
QUERY = "SELECT name, super FROM system_auth.users;"
cursor.execute(QUERY, consistency_level='QUORUM')
COUNT = cursor.rowcount
RESULT = cursor.fetchall()
if [u'cassandra', True] in RESULT:
    print "OK"
else:
    print "BAAAD"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment