Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 119 lines (86 sloc) 3.564 kb
fdeccc9 @vomjom rename to pycassa because of a name conflict with another python project...
vomjom authored
1 pycassa
4bdc6ab @vomjom convert README to markdown
vomjom authored
2 =======
3
4b8741c @thobbs Show Travis CI build status in README
thobbs authored
4 [![Build Status](https://secure.travis-ci.org/pycassa/pycassa.png?branch=master)](http://travis-ci.org/pycassa/pycassa)
5
5a8fbbd @thobbs Add notes about using the native protocol driver
thobbs authored
6 pycassa is a Thrift-based python client library for [Apache Cassandra](http://cassandra.apache.org)
4bdc6ab @vomjom convert README to markdown
vomjom authored
7
7441430 @thobbs Fix readme, doc formatting
thobbs authored
8 **pycassa does not support CQL** or Cassandra's native protocol, which are a
5a8fbbd @thobbs Add notes about using the native protocol driver
thobbs authored
9 replacement for the Thrift interface that pycassa is based on. If you are
7441430 @thobbs Fix readme, doc formatting
thobbs authored
10 starting a new project, **it is highly recommended that you use the newer**
5a8fbbd @thobbs Add notes about using the native protocol driver
thobbs authored
11 [DataStax python driver](https://github.com/datastax/python-driver) instead
12 of pycassa.
89cb437 @thobbs README cleanup of features and connect() usage
thobbs authored
13
5a8fbbd @thobbs Add notes about using the native protocol driver
thobbs authored
14 pycassa is open source under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
9ea00c8 @thobbs Add license and repo link to doc front page
thobbs authored
15
cc4334d @thobbs Linked to documentation in README
thobbs authored
16 Documentation
17 -------------
18
59b12d4 @thobbs Moved a lot of documentation from the README into the docs
thobbs authored
19 Documentation can be found here:
cc4334d @thobbs Linked to documentation in README
thobbs authored
20
21 [http://pycassa.github.com/pycassa/](http://pycassa.github.com/pycassa/)
22
59b12d4 @thobbs Moved a lot of documentation from the README into the docs
thobbs authored
23 It includes [installation instructions](http://pycassa.github.com/pycassa/installation.html),
24 a [tutorial](http://pycassa.github.com/pycassa/tutorial.html),
25 [API documentation](http://pycassa.github.com/pycassa/api/index.html),
26 and a [change log](http://pycassa.github.com/pycassa/changelog.html).
27
6c17a11 @thobbs Update README.mkd
thobbs authored
28 Getting Help
29 ------------
30
31 IRC:
59b12d4 @thobbs Moved a lot of documentation from the README into the docs
thobbs authored
32
fbdd570 @thobbs README touchups
thobbs authored
33 * Use the #cassandra channel on irc.freenode.net. If you don't have an IRC client,
59b12d4 @thobbs Moved a lot of documentation from the README into the docs
thobbs authored
34 you can use [freenode's web based client](http://webchat.freenode.net/?channels=#cassandra).
4f8b9a8 @vomjom mention IRC channel for questions
vomjom authored
35
6c17a11 @thobbs Update README.mkd
thobbs authored
36 Mailing List:
59b12d4 @thobbs Moved a lot of documentation from the README into the docs
thobbs authored
37
38 * User list: [http://groups.google.com/group/pycassa-discuss](http://groups.google.com/group/pycassa-discuss)
39 * Developer list: [http://groups.google.com/group/pycassa-devel](http://groups.google.com/group/pycassa-devel)
4f8b9a8 @vomjom mention IRC channel for questions
vomjom authored
40
1ab10b6 @vomjom add optional setup.py flag to install cassandra package
vomjom authored
41 Installation
42 ------------
43
1c47f29 @thobbs Minor tweaks to README.mkd
thobbs authored
44 If pip is available, you can install the lastest pycassa release
fbdd570 @thobbs README touchups
thobbs authored
45 with:
6c17a11 @thobbs Update README.mkd
thobbs authored
46
1c47f29 @thobbs Minor tweaks to README.mkd
thobbs authored
47 pip install pycassa
6c17a11 @thobbs Update README.mkd
thobbs authored
48
fbdd570 @thobbs README touchups
thobbs authored
49 If you want to install from a source checkout, make sure you have Thrift
50 installed, and run setup.py as a superuser:
1ab10b6 @vomjom add optional setup.py flag to install cassandra package
vomjom authored
51
1c47f29 @thobbs Minor tweaks to README.mkd
thobbs authored
52 pip install thrift
1ab10b6 @vomjom add optional setup.py flag to install cassandra package
vomjom authored
53 python setup.py install
54
fdf8b9e @thobbs Simplify README "Basic Usage" section
thobbs authored
55 Basic Usage
56 -----------
4bdc6ab @vomjom convert README to markdown
vomjom authored
57
6c17a11 @thobbs Update README.mkd
thobbs authored
58 To get a connection pool, pass a Keyspace and an optional list of servers:
5094347 @vomjom clarify timeouts in README
vomjom authored
59
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
60 ~~~~~~ {python}
61 >>> import pycassa
62 >>> pool = pycassa.ConnectionPool('Keyspace1') # Defaults to connecting to the server at 'localhost:9160'
fbdd570 @thobbs README touchups
thobbs authored
63 >>>
64 >>> # or, we can specify our servers:
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
65 >>> pool = pycassa.ConnectionPool('Keyspace1', server_list=['192.168.2.10'])
66 ~~~~~~
2e23389 @vomjom add login()
vomjom authored
67
bf412d3 @vomjom remove emphasis
vomjom authored
68 To use the standard interface, create a ColumnFamily instance.
47730d9 @vomjom update README to reflect new features
vomjom authored
69
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
70 ~~~~~~ {python}
71 >>> pool = pycassa.ConnectionPool('Keyspace1')
72 >>> cf = pycassa.ColumnFamily(pool, 'Standard1')
73 >>> cf.insert('foo', {'column1': 'val1'})
74 >>> cf.get('foo')
75 {'column1': 'val1'}
76 ~~~~~~
4bdc6ab @vomjom convert README to markdown
vomjom authored
77
fbdd570 @thobbs README touchups
thobbs authored
78 insert() will also update existing columns:
4bdc6ab @vomjom convert README to markdown
vomjom authored
79
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
80 ~~~~~~ {python}
81 >>> cf.insert('foo', {'column1': 'val2'})
82 >>> cf.get('foo')
83 {'column1': 'val2'}
84 ~~~~~~
4bdc6ab @vomjom convert README to markdown
vomjom authored
85
542d1b2 @thobbs Documentation and README updates
thobbs authored
86 You may insert multiple columns at once:
4bdc6ab @vomjom convert README to markdown
vomjom authored
87
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
88 ~~~~~~ {python}
89 >>> cf.insert('bar', {'column1': 'val3', 'column2': 'val4'})
90 >>> cf.multiget(['foo', 'bar'])
91 {'foo': {'column1': 'val2'}, 'bar': {'column1': 'val3', 'column2': 'val4'}}
92 >>> cf.get_count('bar')
93 2
94 ~~~~~~
4bdc6ab @vomjom convert README to markdown
vomjom authored
95
fbdd570 @thobbs README touchups
thobbs authored
96 get_range() returns an iterable. You can use list() to convert it to a list:
4bdc6ab @vomjom convert README to markdown
vomjom authored
97
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
98 ~~~~~~ {python}
99 >>> list(cf.get_range())
100 [('bar', {'column1': 'val3', 'column2': 'val4'}), ('foo', {'column1': 'val2'})]
101 >>> list(cf.get_range(row_count=1))
102 [('bar', {'column1': 'val3', 'column2': 'val4'})]
103 ~~~~~~
4bdc6ab @vomjom convert README to markdown
vomjom authored
104
fbdd570 @thobbs README touchups
thobbs authored
105 You can remove entire keys or just a certain column:
4bdc6ab @vomjom convert README to markdown
vomjom authored
106
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
107 ~~~~~~ {python}
108 >>> cf.remove('bar', columns=['column1'])
109 >>> cf.get('bar')
110 {'column2': 'val4'}
111 >>> cf.remove('bar')
112 >>> cf.get('bar')
113 Traceback (most recent call last):
114 ...
1c47f29 @thobbs Minor tweaks to README.mkd
thobbs authored
115 pycassa.NotFoundException: NotFoundException()
32e9686 @thobbs Syntax highlighting for the README
thobbs authored
116 ~~~~~~
fdf8b9e @thobbs Simplify README "Basic Usage" section
thobbs authored
117
118 See the [tutorial](http://pycassa.github.com/pycassa/tutorial.html#connecting-to-cassandra) for more details.
Something went wrong with that request. Please try again.