Created
August 20, 2010 20:28
-
-
Save mizchi/541093 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # -*- encoding:utf-8 -*- | |
| from sys import argv | |
| import os | |
| from lazyboy import * | |
| from lazyboy.key import Key | |
| class PostKey(Key): | |
| def __init__(self, key=None): | |
| Key.__init__(self, "Keyspace1", "Standard1", key) | |
| class PostData(record.Record): | |
| def setKey(self, Key): | |
| self.key = Key | |
| def main(argv): | |
| connection.add_pool('Keyspace1', ['localhost:9160']) | |
| post = PostData() | |
| post.setKey(PostKey("key1")) | |
| post.update({'column1':"foo", 'column2':"bar"}) | |
| post.save() | |
| post = PostData().load(PostKey('key1')) | |
| print post['column1'] | |
| if __name__ == '__main__': | |
| main(argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment