SlideShare uma empresa Scribd logo
1 de 18
Key-Value Storage Systems …  and beyond … with Python
Who the hell are you? + + = Ian Lewis Company: BeProud Tags: #python #django #redbull #mercurial Twitter: IanMLewis HP: http://www.ianlewis.org/
Pro: Fast Simple Con: Can't easily store complex relational data Can't do complex queries Why?
What?
Memcached ,[object Object],[object Object],[object Object],[object Object],[object Object]
python-memcached >>>  import  memcache  >>> client = memcache.Client([ "127.0.0.1:11211" ])  >>> client. set ( "test" ,  1 )  True   >>> client. add ( "test" ,  1 )  False   >>> client. add ( "test2" ,  1 )  True   >>> client. set ( "test" ,  2 )  True   >>> client. incr ( "test" )  3   >>>
Tokyo-Cabinet/Tyrant ,[object Object],[object Object],[object Object],[object Object],[object Object]
python-tokyotyrant/pytyrant >>>  import  pytyrant  >>> t = pytyrant.PyTyrant. open ( '127.0.0.1' ,  1978 )  >>> t[ '__test_key__' ] =  'foo'   >>> t. concat ( '__test_key__' ,  'bar' )  >>>  print  t[ '__test_key__' ]  foobar  >>>  del  t[ '__test_key__' ] PY-
B+ Trees
pytc >>>  import  pytc >>> db = pytc.BDB( 'bdb.db' , pytc.BDBOWRITER | pytc.BDBOCREAT) >>> db[ 'niku' ] =  'umai' >>> db[ 'niku' ] 'umai' >>> db[ 'ra-men' ] =  'kuitai' >>> db[ 'ra-men' ] 'kuitai' >>>  for  key  in  db: >>>  print   'key:' , key,  ' value:' , db[key] 'key: niki value: umai' 'key: ra-men value: kuitai'
= ?
redis ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
So I can't eat it?
>>>  from  redis  import  Redis, ConnectionError, ResponseError >>> r = Redis(db= 9 ) >>> r[ 'a' ] =  24 . 0 >>> r[ 'a' ] Decimal( "24.0" ) >>> r = Redis(db= 9 , float_fn= float ) >>> r[ 'a' ] 24 . 0 >>>  del  r[ 'a' ] >>>  print  r.get( 'a' )  # r['a'] will raise KeyError None redis-py
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Cassandra
Cassandra
pycassa import  pycassa CLIENT = pycassa.connect_thread_local(framed_transport= True ) USER = pycassa.ColumnFamily(CLIENT,  'Twissandra' ,  'User' , dict_class=OrderedDict) ... TWEET = pycassa.ColumnFamily(CLIENT,  'Twissandra' ,  'Tweet' , dict_class=OrderedDict) TIMELINE = pycassa.ColumnFamily(CLIENT,  'Twissandra' ,  'Timeline' , dict_class=OrderedDict) ... timeline = TIMELINE.get( str (user_id), column_start=start, column_count=limit, column_reversed= True ) tweets = TWEET.multiget(timeline.values())
Questions!

Mais conteúdo relacionado

Mais procurados

Speeding up Page Load Times by Using the Starling Queue Server
Speeding up Page Load Times by Using the Starling Queue ServerSpeeding up Page Load Times by Using the Starling Queue Server
Speeding up Page Load Times by Using the Starling Queue ServerErik Osterman
 
Old man emu by john williamson
Old man emu by john williamsonOld man emu by john williamson
Old man emu by john williamsonRobyn Scott
 
HTML, WordPress, and SEO
HTML, WordPress, and SEOHTML, WordPress, and SEO
HTML, WordPress, and SEOBrian Whalley
 
Basic HTML CSS Slides
Basic HTML CSS Slides Basic HTML CSS Slides
Basic HTML CSS Slides Allyson Wehrs
 
Kansas City WordCamp - Website Performance
Kansas City WordCamp - Website PerformanceKansas City WordCamp - Website Performance
Kansas City WordCamp - Website PerformanceKevin Potts
 

Mais procurados (6)

Speeding up Page Load Times by Using the Starling Queue Server
Speeding up Page Load Times by Using the Starling Queue ServerSpeeding up Page Load Times by Using the Starling Queue Server
Speeding up Page Load Times by Using the Starling Queue Server
 
Old man emu by john williamson
Old man emu by john williamsonOld man emu by john williamson
Old man emu by john williamson
 
HTML, WordPress, and SEO
HTML, WordPress, and SEOHTML, WordPress, and SEO
HTML, WordPress, and SEO
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
 
Basic HTML CSS Slides
Basic HTML CSS Slides Basic HTML CSS Slides
Basic HTML CSS Slides
 
Kansas City WordCamp - Website Performance
Kansas City WordCamp - Website PerformanceKansas City WordCamp - Website Performance
Kansas City WordCamp - Website Performance
 

Semelhante a Key Value Storage Systems ... and Beyond ... with Python

What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...
FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...
FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...aindilis
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Tatsuhiko Miyagawa
 
Perl Teach-In (part 1)
Perl Teach-In (part 1)Perl Teach-In (part 1)
Perl Teach-In (part 1)Dave Cross
 
Why Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, MarakanaWhy Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, MarakanaMarko Gargenta
 
jQuery - Doing it right
jQuery - Doing it rightjQuery - Doing it right
jQuery - Doing it rightgirish82
 
Getting started with MongoDB and PHP
Getting started with MongoDB and PHPGetting started with MongoDB and PHP
Getting started with MongoDB and PHPgates10gen
 
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09Ilya Grigorik
 
Good practices for PrestaShop code security and optimization
Good practices for PrestaShop code security and optimizationGood practices for PrestaShop code security and optimization
Good practices for PrestaShop code security and optimizationPrestaShop
 
Complex Values
Complex ValuesComplex Values
Complex ValuesESUG
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With PhpJeremy Coates
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)MongoSF
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
PHP Presentation
PHP PresentationPHP Presentation
PHP PresentationAnkush Jain
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniternicdev
 
Redis And python at pycon_2011
Redis And python at pycon_2011Redis And python at pycon_2011
Redis And python at pycon_2011sunilar0ra
 
Graph Databases
Graph DatabasesGraph Databases
Graph DatabasesJosh Adell
 
Introducing Modern Perl
Introducing Modern PerlIntroducing Modern Perl
Introducing Modern PerlDave Cross
 
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]Chris Toohey
 

Semelhante a Key Value Storage Systems ... and Beyond ... with Python (20)

What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...
FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...
FRDCSA Temporal Planning and Inferencing for Task Management through the Verb...
 
Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8Web Scraper Shibuya.pm tech talk #8
Web Scraper Shibuya.pm tech talk #8
 
Perl Teach-In (part 1)
Perl Teach-In (part 1)Perl Teach-In (part 1)
Perl Teach-In (part 1)
 
Why Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, MarakanaWhy Python by Marilyn Davis, Marakana
Why Python by Marilyn Davis, Marakana
 
What's New in ZF 1.10
What's New in ZF 1.10What's New in ZF 1.10
What's New in ZF 1.10
 
jQuery - Doing it right
jQuery - Doing it rightjQuery - Doing it right
jQuery - Doing it right
 
Getting started with MongoDB and PHP
Getting started with MongoDB and PHPGetting started with MongoDB and PHP
Getting started with MongoDB and PHP
 
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
Lean & Mean Tokyo Cabinet Recipes (with Lua) - FutureRuby '09
 
Good practices for PrestaShop code security and optimization
Good practices for PrestaShop code security and optimizationGood practices for PrestaShop code security and optimization
Good practices for PrestaShop code security and optimization
 
Complex Values
Complex ValuesComplex Values
Complex Values
 
Exploiting Php With Php
Exploiting Php With PhpExploiting Php With Php
Exploiting Php With Php
 
Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)Schema design with MongoDB (Dwight Merriman)
Schema design with MongoDB (Dwight Merriman)
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
Redis And python at pycon_2011
Redis And python at pycon_2011Redis And python at pycon_2011
Redis And python at pycon_2011
 
Graph Databases
Graph DatabasesGraph Databases
Graph Databases
 
Introducing Modern Perl
Introducing Modern PerlIntroducing Modern Perl
Introducing Modern Perl
 
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
 

Mais de Ian Lewis

Appengine ja-night-20110222
Appengine ja-night-20110222Appengine ja-night-20110222
Appengine ja-night-20110222Ian Lewis
 
Twisted ロングポーリング チャット サーバ
Twisted ロングポーリング チャット サーバTwisted ロングポーリング チャット サーバ
Twisted ロングポーリング チャット サーバIan Lewis
 
Sphinx 1.1 i18n 機能紹介
Sphinx 1.1 i18n 機能紹介Sphinx 1.1 i18n 機能紹介
Sphinx 1.1 i18n 機能紹介Ian Lewis
 
BPStudy #40 - Google Appengine 1.4.0
BPStudy #40 - Google Appengine 1.4.0BPStudy #40 - Google Appengine 1.4.0
BPStudy #40 - Google Appengine 1.4.0Ian Lewis
 
Djangoアプリの実践的設計手法
Djangoアプリの実践的設計手法Djangoアプリの実践的設計手法
Djangoアプリの実践的設計手法Ian Lewis
 
Celery Task Queue
Celery Task QueueCelery Task Queue
Celery Task QueueIan Lewis
 
Django O/R Mapper
Django O/R MapperDjango O/R Mapper
Django O/R MapperIan Lewis
 

Mais de Ian Lewis (7)

Appengine ja-night-20110222
Appengine ja-night-20110222Appengine ja-night-20110222
Appengine ja-night-20110222
 
Twisted ロングポーリング チャット サーバ
Twisted ロングポーリング チャット サーバTwisted ロングポーリング チャット サーバ
Twisted ロングポーリング チャット サーバ
 
Sphinx 1.1 i18n 機能紹介
Sphinx 1.1 i18n 機能紹介Sphinx 1.1 i18n 機能紹介
Sphinx 1.1 i18n 機能紹介
 
BPStudy #40 - Google Appengine 1.4.0
BPStudy #40 - Google Appengine 1.4.0BPStudy #40 - Google Appengine 1.4.0
BPStudy #40 - Google Appengine 1.4.0
 
Djangoアプリの実践的設計手法
Djangoアプリの実践的設計手法Djangoアプリの実践的設計手法
Djangoアプリの実践的設計手法
 
Celery Task Queue
Celery Task QueueCelery Task Queue
Celery Task Queue
 
Django O/R Mapper
Django O/R MapperDjango O/R Mapper
Django O/R Mapper
 

Último

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Key Value Storage Systems ... and Beyond ... with Python

  • 1. Key-Value Storage Systems … and beyond … with Python
  • 2. Who the hell are you? + + = Ian Lewis Company: BeProud Tags: #python #django #redbull #mercurial Twitter: IanMLewis HP: http://www.ianlewis.org/
  • 3. Pro: Fast Simple Con: Can't easily store complex relational data Can't do complex queries Why?
  • 5.
  • 6. python-memcached >>> import memcache >>> client = memcache.Client([ "127.0.0.1:11211" ]) >>> client. set ( "test" , 1 ) True >>> client. add ( "test" , 1 ) False >>> client. add ( "test2" , 1 ) True >>> client. set ( "test" , 2 ) True >>> client. incr ( "test" ) 3 >>>
  • 7.
  • 8. python-tokyotyrant/pytyrant >>> import pytyrant >>> t = pytyrant.PyTyrant. open ( '127.0.0.1' , 1978 ) >>> t[ '__test_key__' ] = 'foo' >>> t. concat ( '__test_key__' , 'bar' ) >>> print t[ '__test_key__' ] foobar >>> del t[ '__test_key__' ] PY-
  • 10. pytc >>> import pytc >>> db = pytc.BDB( 'bdb.db' , pytc.BDBOWRITER | pytc.BDBOCREAT) >>> db[ 'niku' ] = 'umai' >>> db[ 'niku' ] 'umai' >>> db[ 'ra-men' ] = 'kuitai' >>> db[ 'ra-men' ] 'kuitai' >>> for key in db: >>> print 'key:' , key, ' value:' , db[key] 'key: niki value: umai' 'key: ra-men value: kuitai'
  • 11. = ?
  • 12.
  • 13. So I can't eat it?
  • 14. >>> from redis import Redis, ConnectionError, ResponseError >>> r = Redis(db= 9 ) >>> r[ 'a' ] = 24 . 0 >>> r[ 'a' ] Decimal( "24.0" ) >>> r = Redis(db= 9 , float_fn= float ) >>> r[ 'a' ] 24 . 0 >>> del r[ 'a' ] >>> print r.get( 'a' ) # r['a'] will raise KeyError None redis-py
  • 15.
  • 17. pycassa import pycassa CLIENT = pycassa.connect_thread_local(framed_transport= True ) USER = pycassa.ColumnFamily(CLIENT, 'Twissandra' , 'User' , dict_class=OrderedDict) ... TWEET = pycassa.ColumnFamily(CLIENT, 'Twissandra' , 'Tweet' , dict_class=OrderedDict) TIMELINE = pycassa.ColumnFamily(CLIENT, 'Twissandra' , 'Timeline' , dict_class=OrderedDict) ... timeline = TIMELINE.get( str (user_id), column_start=start, column_count=limit, column_reversed= True ) tweets = TWEET.multiget(timeline.values())