Click here to load reader
Upload
jon-haddad
View
157
Download
0
Embed Size (px)
DESCRIPTION
Python is a great programming language that works great with Cassandra. If your goal is to get your project into production quickly and iterate fast, Python is a great solution. These slides are an introduction to the hands on portion from GitHub. https://github.com/rustyrazorblade/python-presentation
Citation preview
©2013 DataStax Confidential. Do not distribute without consent.
@rustyrazorblade
Jon HaddadTechnical Evangelist,Datastax
Python & Cassandra, Best Friends
1
Virtual Environments• Isolated environment per project • Build into Python 3.4, available • 3rd party lib in Python 2.7
• pip install virtualenvwrapper• Add to your shell startup file: • source /usr/local/bin/virtualenvwrapper.sh
Before we start• If you'd like to follow along locally, please: • have cassandra running • clone [email protected]:rustyrazorblade/python-presentation.git • create a virtualenv • mkvirtualenv tutorial• install requirements • pip install -r requirements.txt• Start the notebook • ipython notebook
Why Python?• Python is easy to read & write • Python is mature • It takes less time to develop an app in Python • Lots of existing libraries • Principle of least astonishment
•You can be out the door and iterating while the other dev is still working • In most applications, most time is spent waiting on the database •Dev time is usually more costly than the extra server •Correct data model will save you more time than faster app code •Focus on architecture
Native Driver Overview• Provides means of connecting to a cluster and executing CQL3 queries • cassandra.cluster.Cluster keeps track of servers & schema • cassandra.cluster.Session manages connection pool • Cluster.metadata has keyspace, table information • Provides concurrency through cassandra.concurrency• session.execute()
cqlengine overview• Community project (but moving to DataStax) • Created by me & Blake Eggleston (also now at DataStax) • Object mapper on top of the native driver • Removes the need to write most CQL queries manually • Define models, work with regular python types
NO MORE SLIDES!
©2013 DataStax Confidential. Do not distribute without consent. 8