SlideShare a Scribd company logo
1 of 66
Python andMongoDBThe perfect Match Andreas Jung, www.zopyx.com
Trainer Andreas Jung Python developersince 1993 Python, Zope & Plonedevelopment Specialized in Electronic Publishing DirectoroftheZopeFoundation Authorofdozensadd-onsfor Python, ZopeandPlone Co-Founderofthe German Zope User Group (DZUG) Member ofthePloneFoundation usingMongoDBsince 2009
Agenda (45 minutes per slot) IntroductiontoMongoDB UsingMongoDB UsingMongoDBfrom Python withPyMongo (PyMongoextensions/ORM-ishlayersor Q/A)
Things not coveredin thistutorial Geospatialindexing Map-reduce Details on scaling (Sharding, Replicasets)
Part I/4 IntroductiontoMongoDB: ConceptsofMongoDB Architecture HowMongoDBcompareswith relational databases Scalability
MongoDBis... an open-source, high-performance, schema-less, document-oriented database
Let‘sagree on thefollowingorleave... MongoDBis cool MongoDBis not the multi-purpose-one-size-fits-all database MongoDBisanotheradditionaltoolforthesoftwaredeveloper MongoDBis not a replacementfor RDBMS in general Usetherighttoolforeachtask
And..... Don‘taskmeabouthowto do JOINs in MongoDB
Oh, SQL – let‘shavesomefunfirst A SQL statementwalksinto a bar andseestwotables. He walksandsays: „Hello, may I joinyou“ A SQL injectionwalksinto a bar andstartstoquotesomething but suddenlystops, drops a tableanddashes out.
The historyofMongoDB 10gen founded in 2007 Startedascloud-alternative GAE App-engineed Database p Javascriptasimplementationlanguage 2008: focusing on thedatabasepart: MongoDB 2009: firstMongoDBrelease 2011: MongoDB 1.8: Major deployments A fast growingcommunity Fast adoptationfor large projects 10gen growing
Major MongoDBdeployments
MongoDBis schema-less JSON-style datastore Eachdocumentcanhaveitsownschema Documentsinside a collectionusuallyshare a commonschemabyconvention {‚name‘ : ‚kate‘, ‚age‘:12, } {‚name‘ : ‚adam‘, ‚height‘ : 180} {‚q‘: 1234, ‚x‘ = [‚foo‘, ‚bar‘]}
Terminology: RDBMS vs. MongoDB
CharacteristicsofMongoDB (I) High-performance Rich querylanguage (similarto SQL) Map-Reduce (ifyoureallyneedit) Secondaryindexes Geospatialindexing Replication Auto-sharing (partitioningofdata) Manyplatforms, driversformanylanguages
CharacteristicsofMongoDB (II) Notransactionsupport, onlyatomicoperations Default: „fire-and-forget“ modefor high throughput „Safe-Mode“: waitforserverconfirmation, checkingforerrors
Typicalperformancecharacteristics Decentcommoditiyhardware: Upto 100.000 read/writes per second (fire-and-forget) Upto 50.000 reads/writes per second (safemode) Yourmileagemayvary– depending on RAM Speed IO system CPU Client-sidedriver& application
Functionality vs. Scability
MongoDB: Pros & Cons
Durability Default: fire-and-forget (usesafe-mode) Changesarekept in RAM (!) Fsynctodiskevery 60 seconds (default) Deploymentoptions: Standaloneinstallation: usejournaling (V 1.8+) Replicated: usereplicasets(s)
Differences from Typical RDBMS Memory mapped data All data in memory (if it fits), synced to disk periodically No joins Reads have greater data locality No joins between servers No transactions Improves performance of various operations No transactions between servers
Replica Sets Cluster of N servers Only one node is ‘primary’ at a time This is equivalent to master The node where writes go Primary is elected by concensus Automatic failover Automatic recovery of failed nodes
Replica Sets - Writes A write is only ‘committed’ once it has been replicated to a majority of nodes in the set Before this happens, reads to the set may or may not see the write On failover, data which is not ‘committed’ may be dropped (but not necessarily) If dropped, it will be rolled back from all servers which wrote it For improved durability, use getLastError/w Other criteria – block writes when nodes go down or slaves get too far behind Or, to reduce latency, reduce getLastError/w
Replica Sets - Nodes Nodes monitor each other’s heartbeats If primary can’t see a majority of nodes, it relinquishes primary status If a majority of nodes notice there is no primary, they elect a primary using criteria Node priority Node data’s freshness
Replica Sets - Nodes Member 1 Member 2 Member 3
Replica Sets - Nodes {a:1} Member 1 SECONDARY {a:1} {b:2} Member 2 SECONDARY {a:1} {b:2} {c:3} Member 3 PRIMARY
Replica Sets - Nodes {a:1} Member 1 SECONDARY {a:1} {b:2} Member 2 PRIMARY {a:1} {b:2} {c:3} Member 3 DOWN
Replica Sets - Nodes {a:1} {b:2} Member 1 SECONDARY {a:1} {b:2} Member 2 PRIMARY {a:1} {b:2} {c:3} Member 3 RECOVERING
Replica Sets - Nodes {a:1} {b:2} Member 1 SECONDARY {a:1} {b:2} Member 2 PRIMARY {a:1} {b:2} Member 3 SECONDARY
Replica Sets – Node Types Standard – can be primary or secondary Passive – will be secondary but never primary Arbiter – will vote on primary, but won’t replicate data
SlaveOk db.getMongo().setSlaveOk(); Syntax varies by driver Writes to master, reads to slave Slave will be picked arbitrarily
Sharding Architecture
Shard A replica set Manages a well defined range of shard keys
Shard Distribute data across machines Reduce data per machine Better able to fit in RAM Distribute write load across shards Distribute read load across shards, and across nodes within shards
Shard Key { user_id: 1 } { lastname: 1, firstname: 1 } { tag: 1, timestamp: -1 } { _id: 1 } This is the default
Mongos Routes data to/from shards db.users.find( { user_id: 5000 } ) db.users.find( { user_id: { $gt: 4000, $lt: 6000 } } ) db.users.find( { hometown: ‘Seattle’ } ) db.users.find( { hometown: ‘Seattle’ } ).sort( { user_id: 1 } )
Differences from Typical RDBMS Memory mapped data All data in memory (if it fits), synced to disk periodically No joins Reads have greater data locality No joins between servers No transactions Improves performance of various operations No transactions between servers A weak authentication and authorization model
Part 2/4 UsingMongoDB StartingMongoDB Usingtheinteractive Mongo console Basic databaseoperations
Gettingstarted...theserver wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.8.1.tgz tarxfzmongodb-osx-x86_64-1.8.1.tgz cd mongodb-osx-x86_64-1.8.1 mkdir /tmp/db bin/mongod –dbpath /tmp/db Pick upyour  OS-specificpackagefromhttp://www.mongodb.org/downloads Take careof 32 bitbs. 64 bitversion
Gettingstarted...theconsole bin/mongod mongodlistenstoport 27017 bydefault HTTP interface on port 28017 > help > db.help() > db.some_collection.help()
Datatypes... Remember: MongoDBis schema-less MongoDBsupports JSON + some extra types
A smalladdressdatabase Person: firstname lastname birthday city phone
Inserting > db.foo.insert(document) > db.foo.insert({‚firstname‘ : ‚Ben‘}) everydocumenthas an „_id“ field „_id“ insertedautomaticallyif not present
Querying > db.foo.find(query_expression) > db.foo.find({‚firstname‘ : ‚Ben‘}) Queriesareexpressedusing JSON notationwith JSON/BSON objects queryexpressionscombinedusing AND (bydefault) http://www.mongodb.org/display/DOCS/Querying
Queryingwithsorting > db.foo.find({}).sort({‚firstname‘ :1, ‚age‘: -1}) sortingspecification in JSON notation 1 = ascending, -1 = descending
Advancedquerying $all $exists $mod $ne $in $nin $nor $or $size $type http://www.mongodb.org/display/DOCS/Advanced+Queries
Updating > db.foo.update(criteria, obj, multi, upsert) update() updatesonlyonedocumentbydefault (specifymulti=1) upsert=1: ifdocumentdoes not exist, insertit
Updating – modifieroperations $inc $set $unset $push $pushAll $addToSet $pop $pull $pullAll $rename $bit http://www.mongodb.org/display/DOCS/Updating
Updating > db.foo.update(criteria, obj, multi, upsert) update() updatesonlyonedocumentbydefault (specifymulti=1) upsert=1: ifdocumentdoes not exist, insertit
Removing db.foo.remove({})                             // remove all db.foo.remove({‚firstname‘ : ‚Ben‘})  // removebykey db.foo.remove({‚_id‘ : ObjectId(...)}) // removeby _id Atomicremoval(locksthedatabase) db.foo.remove( { age: 42, $atomic : true } ) http://www.mongodb.org/display/DOCS/Removing
Indexes workingsimilartoindex in relational databases db.foo.ensureIndex({age: 1}, {background: true}) onequery– oneindex CompoundIndexes db.foo.ensureIndex({age: 1, firstname:-1} Orderingofqueryparametersmatters http://www.mongodb.org/display/DOCS/Indexes
Embedded documents MongoDBdocs = JSON/BSON-like Embeededdocumentssimilarnesteddicts in Python db.foo.insert({firstname:‘Ben‘, data:{a:1, b:2, c:3}) db.foo.find({‚data.a‘:1}) Dottednotationforreachingintoembeddedocuments Usequotesarounddottednames Indexes work on embeddesdocuments
Arrays (1/2) Like (nested) lists in Python db.foo.insert({colors: [‚green‘, ‚blue‘, ‚red‘]}) db.foo.find({colors: ‚red‘}) Useindexes
Arrays (2/2) – matchingarrays db.bar.insert({users: [                         {name: ‚Hans‘, age:42},                         {name:‘Jim‘, age: 30 },                      ]}) db.bar.find({users : {‚$elemMatch‘: {age : {$gt:42}}}})
Part 3/4 UsingMongoDBfrom Python  PyMongo InstallingPyMongo UsingPyMongo
InstallingandtestingPyMongo Installpymongo virtualenv –no-site-packagespymongo bin/easy_installpymongo Start MongoDB mkdir /tmp/db mongod –dbpath /tmp/db Start Python bin/python > importpymongo > conn = pymongo.Connection(‚localhost‘, 27127)
Part 4/4 ? High-level PyMongoframeworks Mongokit Mongoengine MongoAlchemy ? Migration SQL toMongoDB ? Q/A ? Lookingat a real worldprojectdonewithPyramidandMongoDB? ? Let‘stalkabout..
Mongokit (1/3) schemavalidation (wich usesimple pythontype forthedeclaration) dotednotation nestedandcomplexschemadeclaration untypedfieldsupport requiredfieldsvalidation defaultvalues customvalidators crossdatabasedocumentreference randomquerysupport (whichreturns a randomdocumentfromthedatabase) inheritanceandpolymorphismesupport versionizeddocumentsupport (in betastage) partial authsupport (itbrings a simple User model) operatorforvalidation (currently : OR, NOT and IS) simple web frameworkintegration import/exporttojson i18n support GridFSsupport documentmigrationsupport
Mongokit (2/3) classBlogPost(Document): structure = {         'title': unicode,         'body': unicode,         'author': pymongo.objectid.ObjectId,         'created_at': datetime.datetime,         'tags': [unicode],     } required_fields = ['title','author', 'date_creation'] blog_post = BlogPost() blog_post['title'] = 'myblogpost' blog_post['created_at'] = datetime.datetime.utcnow() blog_post.save()
Mongokit (3/3) Speed andperformanceimpact Mongokitisalwaysbehindthemostcurrentpymongoversions one-man developershow http://namlook.github.com/mongokit/
Mongoengine (1/2) MongoEngineis a Document-Object Mapper (think ORM, but fordocumentdatabases) forworkingwithMongoDBfrom Python. Ituses a simple declarative API, similartotheDjango ORM. http://mongoengine.org/
Mongokit (2/2) classBlogPost(Document):     title = StringField(required=True) body = StringField() author = ReferenceField(User) created_at = DateTimeField(required=True)     tags = ListField(StringField()) blog_post = BlogPost(title='myblogpost', created_at=datetime.datetime.utcnow()) blog_post.save()
MongoAlchemy (1/2) MongoAlchemyis a layer on top ofthe Python MongoDBdriverwhichadds client-sideschemadefinitions, an easiertoworkwithandprogrammaticquerylanguage, and a Document-Objectmapperwhichallowspythonobjectstobesavedandloadedintothedatabase in a type-safe way. An explicit goalofthisprojectistobeabletoperformasmanyoperationsaspossiblewithouthavingtoperform a load/save cyclesincedoing so isbothsignificantlyslowerandmorelikelytocausedataloss. http://mongoalchemy.org/
MongoAlchemy(2/2) frommongoalchemy.documentimportDocument, DocumentField frommongoalchemy.fieldsimport * fromdatetimeimportdatetime frompprintimportpprint class Event(Document): name = StringField() children = ListField(DocumentField('Event')) begin = DateTimeField()     end = DateTimeField() def __init__(self, name, parent=None): Document.__init__(self, name=name) self.children = [] ifparent != None: parent.children.append(self)
From SQL toMongoDB
The CAP theorem Consistency Availablity TolerancetonetworkPartitions Pick two...
ACID versus Base Atomicity Consistency Isolation Durability BasicallyAvailable Soft state Eventuallyconsistent

More Related Content

What's hot

Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Katy Slemon
 
Lucene revolution 2011
Lucene revolution 2011Lucene revolution 2011
Lucene revolution 2011Takahiko Ito
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppet
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSencha
 
Inside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryInside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryEDB
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008Robert Treat
 
No REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystNo REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystJay Shirley
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operationsgrim_radical
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubEssam Salah
 
JRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing WorldJRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing WorldSATOSHI TAGOMORI
 
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...Lucidworks
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Ontico
 
ITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and ScaleITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and ScaleIstanbul Tech Talks
 

What's hot (20)

Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3
 
Lucene revolution 2011
Lucene revolution 2011Lucene revolution 2011
Lucene revolution 2011
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
 
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don GriffinSenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
SenchaCon 2016: Modernizing the Ext JS Class System - Don Griffin
 
Inside PostgreSQL Shared Memory
Inside PostgreSQL Shared MemoryInside PostgreSQL Shared Memory
Inside PostgreSQL Shared Memory
 
Hdfs java api
Hdfs java apiHdfs java api
Hdfs java api
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
Powershell alias
Powershell aliasPowershell alias
Powershell alias
 
Puppet
PuppetPuppet
Puppet
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008
 
Apache solr liferay
Apache solr liferayApache solr liferay
Apache solr liferay
 
No REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and CatalystNo REST for the Wicked: REST and Catalyst
No REST for the Wicked: REST and Catalyst
 
PuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into OperationsPuppetDB: Sneaking Clojure into Operations
PuppetDB: Sneaking Clojure into Operations
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge Club
 
JRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing WorldJRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing World
 
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
Solr Troubleshooting - Treemap Approach: Presented by Alexandre Rafolovitch, ...
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
 
Dispatch in Clojure
Dispatch in ClojureDispatch in Clojure
Dispatch in Clojure
 
ITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and ScaleITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
ITT 2015 - Simon Stewart - Building Android Apps at Speed and Scale
 

Viewers also liked

MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用iammutex
 
Schema design short
Schema design shortSchema design short
Schema design shortMongoDB
 
XML Director - the technical foundation of onkopedia.com
XML Director - the technical foundation of onkopedia.comXML Director - the technical foundation of onkopedia.com
XML Director - the technical foundation of onkopedia.comAndreas Jung
 
Producing high-quality documents with Plone
Producing high-quality documents with PloneProducing high-quality documents with Plone
Producing high-quality documents with PloneAndreas Jung
 
Pragmatische Plone Projekte
Pragmatische Plone ProjektePragmatische Plone Projekte
Pragmatische Plone ProjekteAndreas Jung
 
BRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLBRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLAndreas Jung
 
Making Py Pi Sux Less Key
Making Py Pi Sux Less KeyMaking Py Pi Sux Less Key
Making Py Pi Sux Less KeyAndreas Jung
 
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...Andreas Jung
 
Frequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeFrequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeAndreas Jung
 
Pragmatic plone projects
Pragmatic plone projectsPragmatic plone projects
Pragmatic plone projectsAndreas Jung
 
Plone Integration with eXist-db - Structured Content rocks
Plone Integration with eXist-db - Structured Content rocksPlone Integration with eXist-db - Structured Content rocks
Plone Integration with eXist-db - Structured Content rocksAndreas Jung
 
State Of Zope Linuxtag 2008
State Of Zope Linuxtag 2008State Of Zope Linuxtag 2008
State Of Zope Linuxtag 2008Andreas Jung
 
Plone4Universities
Plone4UniversitiesPlone4Universities
Plone4UniversitiesAndreas Jung
 
Integration of Plone with eXist-db
Integration of Plone with eXist-dbIntegration of Plone with eXist-db
Integration of Plone with eXist-dbAndreas Jung
 
Produce & Publish Authoring Environment World Plone Day 2010 - Berlin
Produce & Publish Authoring Environment World Plone Day 2010 - BerlinProduce & Publish Authoring Environment World Plone Day 2010 - Berlin
Produce & Publish Authoring Environment World Plone Day 2010 - BerlinAndreas Jung
 
Produce & Publish Authoring Environment V 2.0 (english version)
Produce & Publish Authoring Environment V 2.0 (english version)Produce & Publish Authoring Environment V 2.0 (english version)
Produce & Publish Authoring Environment V 2.0 (english version)Andreas Jung
 
Building bridges - Plone Conference 2015 Bucharest
Building bridges   - Plone Conference 2015 BucharestBuilding bridges   - Plone Conference 2015 Bucharest
Building bridges - Plone Conference 2015 BucharestAndreas Jung
 
CSS Paged Media - A review of tools and techniques
CSS Paged Media - A review of tools and techniquesCSS Paged Media - A review of tools and techniques
CSS Paged Media - A review of tools and techniquesAndreas Jung
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will DieAndreas Jung
 

Viewers also liked (20)

MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用MongoDB 在盛大大数据量下的应用
MongoDB 在盛大大数据量下的应用
 
Schema design short
Schema design shortSchema design short
Schema design short
 
XML Director - the technical foundation of onkopedia.com
XML Director - the technical foundation of onkopedia.comXML Director - the technical foundation of onkopedia.com
XML Director - the technical foundation of onkopedia.com
 
Producing high-quality documents with Plone
Producing high-quality documents with PloneProducing high-quality documents with Plone
Producing high-quality documents with Plone
 
Pragmatische Plone Projekte
Pragmatische Plone ProjektePragmatische Plone Projekte
Pragmatische Plone Projekte
 
BRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQLBRAINREPUBLIC - Powered by no-SQL
BRAINREPUBLIC - Powered by no-SQL
 
Making Py Pi Sux Less Key
Making Py Pi Sux Less KeyMaking Py Pi Sux Less Key
Making Py Pi Sux Less Key
 
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
Onkopedia - Ein medizinisches Leitlinienportal auf dem Weg zu XML-basierten P...
 
Frequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeFrequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last time
 
Pragmatic plone projects
Pragmatic plone projectsPragmatic plone projects
Pragmatic plone projects
 
Plone Integration with eXist-db - Structured Content rocks
Plone Integration with eXist-db - Structured Content rocksPlone Integration with eXist-db - Structured Content rocks
Plone Integration with eXist-db - Structured Content rocks
 
PyFilesystem
PyFilesystemPyFilesystem
PyFilesystem
 
State Of Zope Linuxtag 2008
State Of Zope Linuxtag 2008State Of Zope Linuxtag 2008
State Of Zope Linuxtag 2008
 
Plone4Universities
Plone4UniversitiesPlone4Universities
Plone4Universities
 
Integration of Plone with eXist-db
Integration of Plone with eXist-dbIntegration of Plone with eXist-db
Integration of Plone with eXist-db
 
Produce & Publish Authoring Environment World Plone Day 2010 - Berlin
Produce & Publish Authoring Environment World Plone Day 2010 - BerlinProduce & Publish Authoring Environment World Plone Day 2010 - Berlin
Produce & Publish Authoring Environment World Plone Day 2010 - Berlin
 
Produce & Publish Authoring Environment V 2.0 (english version)
Produce & Publish Authoring Environment V 2.0 (english version)Produce & Publish Authoring Environment V 2.0 (english version)
Produce & Publish Authoring Environment V 2.0 (english version)
 
Building bridges - Plone Conference 2015 Bucharest
Building bridges   - Plone Conference 2015 BucharestBuilding bridges   - Plone Conference 2015 Bucharest
Building bridges - Plone Conference 2015 Bucharest
 
CSS Paged Media - A review of tools and techniques
CSS Paged Media - A review of tools and techniquesCSS Paged Media - A review of tools and techniques
CSS Paged Media - A review of tools and techniques
 
Why Plone Will Die
Why Plone Will DieWhy Plone Will Die
Why Plone Will Die
 

Similar to Python mongo db-training-europython-2011

Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBMongoDB
 
MongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB
 
Invitation to mongo db @ Rakuten TechTalk
Invitation to mongo db @ Rakuten TechTalkInvitation to mongo db @ Rakuten TechTalk
Invitation to mongo db @ Rakuten TechTalkRyuji Tamagawa
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo dbAmit Thakkar
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Michael Renner
 
introtomongodb
introtomongodbintrotomongodb
introtomongodbsaikiran
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBRick Copeland
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introductionTse-Ching Ho
 
MongoSF 2011 - Using MongoDB for IGN's Social Platform
MongoSF 2011 - Using MongoDB for IGN's Social PlatformMongoSF 2011 - Using MongoDB for IGN's Social Platform
MongoSF 2011 - Using MongoDB for IGN's Social PlatformManish Pandit
 
Introduction to Spark
Introduction to SparkIntroduction to Spark
Introduction to SparkLi Ming Tsai
 
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...Josef A. Habdank
 
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos LinardosApache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos LinardosEuangelos Linardos
 
Spark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit
 
How To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceHow To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceMongoDB
 
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...RootedCON
 
10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in production10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in productionParis Data Engineers !
 

Similar to Python mongo db-training-europython-2011 (20)

Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
MongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo SeattleMongoDB Auto-Sharding at Mongo Seattle
MongoDB Auto-Sharding at Mongo Seattle
 
Invitation to mongo db @ Rakuten TechTalk
Invitation to mongo db @ Rakuten TechTalkInvitation to mongo db @ Rakuten TechTalk
Invitation to mongo db @ Rakuten TechTalk
 
mongodb tutorial
mongodb tutorialmongodb tutorial
mongodb tutorial
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
 
MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012MongoDB Devops Madrid February 2012
MongoDB Devops Madrid February 2012
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
MongoSF 2011 - Using MongoDB for IGN's Social Platform
MongoSF 2011 - Using MongoDB for IGN's Social PlatformMongoSF 2011 - Using MongoDB for IGN's Social Platform
MongoSF 2011 - Using MongoDB for IGN's Social Platform
 
Introduction to Spark
Introduction to SparkIntroduction to Spark
Introduction to Spark
 
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
Extreme Apache Spark: how in 3 months we created a pipeline that can process ...
 
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos LinardosApache Spark Workshop, Apr. 2016, Euangelos Linardos
Apache Spark Workshop, Apr. 2016, Euangelos Linardos
 
Spark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross Lawley
 
How To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceHow To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own Datasource
 
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
Sergi Álvarez + Roi Martín - radare2: From forensics to bindiffing [RootedCON...
 
10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in production10 things i wish i'd known before using spark in production
10 things i wish i'd known before using spark in production
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 

More from Andreas Jung

State of PrintCSS - MarkupUK 2023.pdf
State of PrintCSS - MarkupUK 2023.pdfState of PrintCSS - MarkupUK 2023.pdf
State of PrintCSS - MarkupUK 2023.pdfAndreas Jung
 
Typesense Plone Integration Plone Conference 2022 Namur
Typesense Plone Integration Plone Conference 2022 NamurTypesense Plone Integration Plone Conference 2022 Namur
Typesense Plone Integration Plone Conference 2022 NamurAndreas Jung
 
Onkopedia - Plone Tagung 2020 Dresden
Onkopedia - Plone Tagung 2020 DresdenOnkopedia - Plone Tagung 2020 Dresden
Onkopedia - Plone Tagung 2020 DresdenAndreas Jung
 
PrintCSS W3C workshop at XMLPrague 2020
PrintCSS W3C workshop at XMLPrague 2020PrintCSS W3C workshop at XMLPrague 2020
PrintCSS W3C workshop at XMLPrague 2020Andreas Jung
 
PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020Andreas Jung
 
Plone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumPlone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumAndreas Jung
 
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel OnkopediaBack to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel OnkopediaAndreas Jung
 
Plone migrations using plone.restapi
Plone migrations using plone.restapiPlone migrations using plone.restapi
Plone migrations using plone.restapiAndreas Jung
 
Plone Migrationen mit Plone REST API
Plone Migrationen mit Plone REST APIPlone Migrationen mit Plone REST API
Plone Migrationen mit Plone REST APIAndreas Jung
 
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...Andreas Jung
 
Generierung von PDF aus XML/HTML mit PrintCSS
Generierung von PDF aus XML/HTML mit PrintCSSGenerierung von PDF aus XML/HTML mit PrintCSS
Generierung von PDF aus XML/HTML mit PrintCSSAndreas Jung
 
Creating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCsCreating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCsAndreas Jung
 
Creating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCsCreating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCsAndreas Jung
 
The Plone and The Blockchain
The Plone and The BlockchainThe Plone and The Blockchain
The Plone and The BlockchainAndreas Jung
 
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCsContent Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCsAndreas Jung
 
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.Andreas Jung
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseAndreas Jung
 
Produce & Publish Cloud Edition
Produce & Publish Cloud EditionProduce & Publish Cloud Edition
Produce & Publish Cloud EditionAndreas Jung
 
zopyx.plone migration - Plone Hochschultagung 2013
zopyx.plone migration - Plone Hochschultagung 2013zopyx.plone migration - Plone Hochschultagung 2013
zopyx.plone migration - Plone Hochschultagung 2013Andreas Jung
 
Onkopedia - ein medizinisches Fachportal auf Basis von Plone
Onkopedia  - ein medizinisches Fachportal auf Basis von PloneOnkopedia  - ein medizinisches Fachportal auf Basis von Plone
Onkopedia - ein medizinisches Fachportal auf Basis von PloneAndreas Jung
 

More from Andreas Jung (20)

State of PrintCSS - MarkupUK 2023.pdf
State of PrintCSS - MarkupUK 2023.pdfState of PrintCSS - MarkupUK 2023.pdf
State of PrintCSS - MarkupUK 2023.pdf
 
Typesense Plone Integration Plone Conference 2022 Namur
Typesense Plone Integration Plone Conference 2022 NamurTypesense Plone Integration Plone Conference 2022 Namur
Typesense Plone Integration Plone Conference 2022 Namur
 
Onkopedia - Plone Tagung 2020 Dresden
Onkopedia - Plone Tagung 2020 DresdenOnkopedia - Plone Tagung 2020 Dresden
Onkopedia - Plone Tagung 2020 Dresden
 
PrintCSS W3C workshop at XMLPrague 2020
PrintCSS W3C workshop at XMLPrague 2020PrintCSS W3C workshop at XMLPrague 2020
PrintCSS W3C workshop at XMLPrague 2020
 
PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020PrintCSS workshop XMLPrague 2020
PrintCSS workshop XMLPrague 2020
 
Plone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, BelgiumPlone 5.2 migration at University Ghent, Belgium
Plone 5.2 migration at University Ghent, Belgium
 
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel OnkopediaBack to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
Back to the future - Plone 5.2 und Python 3 Migration am Beispiel Onkopedia
 
Plone migrations using plone.restapi
Plone migrations using plone.restapiPlone migrations using plone.restapi
Plone migrations using plone.restapi
 
Plone Migrationen mit Plone REST API
Plone Migrationen mit Plone REST APIPlone Migrationen mit Plone REST API
Plone Migrationen mit Plone REST API
 
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
Plone im Einsatz bei der Universität des Saarländes als Shop-System und Gefah...
 
Generierung von PDF aus XML/HTML mit PrintCSS
Generierung von PDF aus XML/HTML mit PrintCSSGenerierung von PDF aus XML/HTML mit PrintCSS
Generierung von PDF aus XML/HTML mit PrintCSS
 
Creating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCsCreating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCs
 
Creating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCsCreating Content Together - Plone Integration with SMASHDOCs
Creating Content Together - Plone Integration with SMASHDOCs
 
The Plone and The Blockchain
The Plone and The BlockchainThe Plone and The Blockchain
The Plone and The Blockchain
 
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCsContent Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
Content Gemeinsam Erstellen: Integration Plone mit SMASHDOCs
 
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.
PDF Generierung mit XML/HTML und CSS - was die Tools können und was nicht.
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL Database
 
Produce & Publish Cloud Edition
Produce & Publish Cloud EditionProduce & Publish Cloud Edition
Produce & Publish Cloud Edition
 
zopyx.plone migration - Plone Hochschultagung 2013
zopyx.plone migration - Plone Hochschultagung 2013zopyx.plone migration - Plone Hochschultagung 2013
zopyx.plone migration - Plone Hochschultagung 2013
 
Onkopedia - ein medizinisches Fachportal auf Basis von Plone
Onkopedia  - ein medizinisches Fachportal auf Basis von PloneOnkopedia  - ein medizinisches Fachportal auf Basis von Plone
Onkopedia - ein medizinisches Fachportal auf Basis von Plone
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Python mongo db-training-europython-2011

  • 1. Python andMongoDBThe perfect Match Andreas Jung, www.zopyx.com
  • 2. Trainer Andreas Jung Python developersince 1993 Python, Zope & Plonedevelopment Specialized in Electronic Publishing DirectoroftheZopeFoundation Authorofdozensadd-onsfor Python, ZopeandPlone Co-Founderofthe German Zope User Group (DZUG) Member ofthePloneFoundation usingMongoDBsince 2009
  • 3. Agenda (45 minutes per slot) IntroductiontoMongoDB UsingMongoDB UsingMongoDBfrom Python withPyMongo (PyMongoextensions/ORM-ishlayersor Q/A)
  • 4. Things not coveredin thistutorial Geospatialindexing Map-reduce Details on scaling (Sharding, Replicasets)
  • 5. Part I/4 IntroductiontoMongoDB: ConceptsofMongoDB Architecture HowMongoDBcompareswith relational databases Scalability
  • 6. MongoDBis... an open-source, high-performance, schema-less, document-oriented database
  • 7. Let‘sagree on thefollowingorleave... MongoDBis cool MongoDBis not the multi-purpose-one-size-fits-all database MongoDBisanotheradditionaltoolforthesoftwaredeveloper MongoDBis not a replacementfor RDBMS in general Usetherighttoolforeachtask
  • 9. Oh, SQL – let‘shavesomefunfirst A SQL statementwalksinto a bar andseestwotables. He walksandsays: „Hello, may I joinyou“ A SQL injectionwalksinto a bar andstartstoquotesomething but suddenlystops, drops a tableanddashes out.
  • 10. The historyofMongoDB 10gen founded in 2007 Startedascloud-alternative GAE App-engineed Database p Javascriptasimplementationlanguage 2008: focusing on thedatabasepart: MongoDB 2009: firstMongoDBrelease 2011: MongoDB 1.8: Major deployments A fast growingcommunity Fast adoptationfor large projects 10gen growing
  • 12. MongoDBis schema-less JSON-style datastore Eachdocumentcanhaveitsownschema Documentsinside a collectionusuallyshare a commonschemabyconvention {‚name‘ : ‚kate‘, ‚age‘:12, } {‚name‘ : ‚adam‘, ‚height‘ : 180} {‚q‘: 1234, ‚x‘ = [‚foo‘, ‚bar‘]}
  • 14. CharacteristicsofMongoDB (I) High-performance Rich querylanguage (similarto SQL) Map-Reduce (ifyoureallyneedit) Secondaryindexes Geospatialindexing Replication Auto-sharing (partitioningofdata) Manyplatforms, driversformanylanguages
  • 15. CharacteristicsofMongoDB (II) Notransactionsupport, onlyatomicoperations Default: „fire-and-forget“ modefor high throughput „Safe-Mode“: waitforserverconfirmation, checkingforerrors
  • 16. Typicalperformancecharacteristics Decentcommoditiyhardware: Upto 100.000 read/writes per second (fire-and-forget) Upto 50.000 reads/writes per second (safemode) Yourmileagemayvary– depending on RAM Speed IO system CPU Client-sidedriver& application
  • 19. Durability Default: fire-and-forget (usesafe-mode) Changesarekept in RAM (!) Fsynctodiskevery 60 seconds (default) Deploymentoptions: Standaloneinstallation: usejournaling (V 1.8+) Replicated: usereplicasets(s)
  • 20. Differences from Typical RDBMS Memory mapped data All data in memory (if it fits), synced to disk periodically No joins Reads have greater data locality No joins between servers No transactions Improves performance of various operations No transactions between servers
  • 21. Replica Sets Cluster of N servers Only one node is ‘primary’ at a time This is equivalent to master The node where writes go Primary is elected by concensus Automatic failover Automatic recovery of failed nodes
  • 22. Replica Sets - Writes A write is only ‘committed’ once it has been replicated to a majority of nodes in the set Before this happens, reads to the set may or may not see the write On failover, data which is not ‘committed’ may be dropped (but not necessarily) If dropped, it will be rolled back from all servers which wrote it For improved durability, use getLastError/w Other criteria – block writes when nodes go down or slaves get too far behind Or, to reduce latency, reduce getLastError/w
  • 23. Replica Sets - Nodes Nodes monitor each other’s heartbeats If primary can’t see a majority of nodes, it relinquishes primary status If a majority of nodes notice there is no primary, they elect a primary using criteria Node priority Node data’s freshness
  • 24. Replica Sets - Nodes Member 1 Member 2 Member 3
  • 25. Replica Sets - Nodes {a:1} Member 1 SECONDARY {a:1} {b:2} Member 2 SECONDARY {a:1} {b:2} {c:3} Member 3 PRIMARY
  • 26. Replica Sets - Nodes {a:1} Member 1 SECONDARY {a:1} {b:2} Member 2 PRIMARY {a:1} {b:2} {c:3} Member 3 DOWN
  • 27. Replica Sets - Nodes {a:1} {b:2} Member 1 SECONDARY {a:1} {b:2} Member 2 PRIMARY {a:1} {b:2} {c:3} Member 3 RECOVERING
  • 28. Replica Sets - Nodes {a:1} {b:2} Member 1 SECONDARY {a:1} {b:2} Member 2 PRIMARY {a:1} {b:2} Member 3 SECONDARY
  • 29. Replica Sets – Node Types Standard – can be primary or secondary Passive – will be secondary but never primary Arbiter – will vote on primary, but won’t replicate data
  • 30. SlaveOk db.getMongo().setSlaveOk(); Syntax varies by driver Writes to master, reads to slave Slave will be picked arbitrarily
  • 32. Shard A replica set Manages a well defined range of shard keys
  • 33. Shard Distribute data across machines Reduce data per machine Better able to fit in RAM Distribute write load across shards Distribute read load across shards, and across nodes within shards
  • 34. Shard Key { user_id: 1 } { lastname: 1, firstname: 1 } { tag: 1, timestamp: -1 } { _id: 1 } This is the default
  • 35. Mongos Routes data to/from shards db.users.find( { user_id: 5000 } ) db.users.find( { user_id: { $gt: 4000, $lt: 6000 } } ) db.users.find( { hometown: ‘Seattle’ } ) db.users.find( { hometown: ‘Seattle’ } ).sort( { user_id: 1 } )
  • 36. Differences from Typical RDBMS Memory mapped data All data in memory (if it fits), synced to disk periodically No joins Reads have greater data locality No joins between servers No transactions Improves performance of various operations No transactions between servers A weak authentication and authorization model
  • 37. Part 2/4 UsingMongoDB StartingMongoDB Usingtheinteractive Mongo console Basic databaseoperations
  • 38. Gettingstarted...theserver wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.8.1.tgz tarxfzmongodb-osx-x86_64-1.8.1.tgz cd mongodb-osx-x86_64-1.8.1 mkdir /tmp/db bin/mongod –dbpath /tmp/db Pick upyour OS-specificpackagefromhttp://www.mongodb.org/downloads Take careof 32 bitbs. 64 bitversion
  • 39. Gettingstarted...theconsole bin/mongod mongodlistenstoport 27017 bydefault HTTP interface on port 28017 > help > db.help() > db.some_collection.help()
  • 40. Datatypes... Remember: MongoDBis schema-less MongoDBsupports JSON + some extra types
  • 41. A smalladdressdatabase Person: firstname lastname birthday city phone
  • 42. Inserting > db.foo.insert(document) > db.foo.insert({‚firstname‘ : ‚Ben‘}) everydocumenthas an „_id“ field „_id“ insertedautomaticallyif not present
  • 43. Querying > db.foo.find(query_expression) > db.foo.find({‚firstname‘ : ‚Ben‘}) Queriesareexpressedusing JSON notationwith JSON/BSON objects queryexpressionscombinedusing AND (bydefault) http://www.mongodb.org/display/DOCS/Querying
  • 44. Queryingwithsorting > db.foo.find({}).sort({‚firstname‘ :1, ‚age‘: -1}) sortingspecification in JSON notation 1 = ascending, -1 = descending
  • 45. Advancedquerying $all $exists $mod $ne $in $nin $nor $or $size $type http://www.mongodb.org/display/DOCS/Advanced+Queries
  • 46. Updating > db.foo.update(criteria, obj, multi, upsert) update() updatesonlyonedocumentbydefault (specifymulti=1) upsert=1: ifdocumentdoes not exist, insertit
  • 47. Updating – modifieroperations $inc $set $unset $push $pushAll $addToSet $pop $pull $pullAll $rename $bit http://www.mongodb.org/display/DOCS/Updating
  • 48. Updating > db.foo.update(criteria, obj, multi, upsert) update() updatesonlyonedocumentbydefault (specifymulti=1) upsert=1: ifdocumentdoes not exist, insertit
  • 49. Removing db.foo.remove({}) // remove all db.foo.remove({‚firstname‘ : ‚Ben‘}) // removebykey db.foo.remove({‚_id‘ : ObjectId(...)}) // removeby _id Atomicremoval(locksthedatabase) db.foo.remove( { age: 42, $atomic : true } ) http://www.mongodb.org/display/DOCS/Removing
  • 50. Indexes workingsimilartoindex in relational databases db.foo.ensureIndex({age: 1}, {background: true}) onequery– oneindex CompoundIndexes db.foo.ensureIndex({age: 1, firstname:-1} Orderingofqueryparametersmatters http://www.mongodb.org/display/DOCS/Indexes
  • 51. Embedded documents MongoDBdocs = JSON/BSON-like Embeededdocumentssimilarnesteddicts in Python db.foo.insert({firstname:‘Ben‘, data:{a:1, b:2, c:3}) db.foo.find({‚data.a‘:1}) Dottednotationforreachingintoembeddedocuments Usequotesarounddottednames Indexes work on embeddesdocuments
  • 52. Arrays (1/2) Like (nested) lists in Python db.foo.insert({colors: [‚green‘, ‚blue‘, ‚red‘]}) db.foo.find({colors: ‚red‘}) Useindexes
  • 53. Arrays (2/2) – matchingarrays db.bar.insert({users: [ {name: ‚Hans‘, age:42}, {name:‘Jim‘, age: 30 }, ]}) db.bar.find({users : {‚$elemMatch‘: {age : {$gt:42}}}})
  • 54. Part 3/4 UsingMongoDBfrom Python PyMongo InstallingPyMongo UsingPyMongo
  • 55. InstallingandtestingPyMongo Installpymongo virtualenv –no-site-packagespymongo bin/easy_installpymongo Start MongoDB mkdir /tmp/db mongod –dbpath /tmp/db Start Python bin/python > importpymongo > conn = pymongo.Connection(‚localhost‘, 27127)
  • 56. Part 4/4 ? High-level PyMongoframeworks Mongokit Mongoengine MongoAlchemy ? Migration SQL toMongoDB ? Q/A ? Lookingat a real worldprojectdonewithPyramidandMongoDB? ? Let‘stalkabout..
  • 57. Mongokit (1/3) schemavalidation (wich usesimple pythontype forthedeclaration) dotednotation nestedandcomplexschemadeclaration untypedfieldsupport requiredfieldsvalidation defaultvalues customvalidators crossdatabasedocumentreference randomquerysupport (whichreturns a randomdocumentfromthedatabase) inheritanceandpolymorphismesupport versionizeddocumentsupport (in betastage) partial authsupport (itbrings a simple User model) operatorforvalidation (currently : OR, NOT and IS) simple web frameworkintegration import/exporttojson i18n support GridFSsupport documentmigrationsupport
  • 58. Mongokit (2/3) classBlogPost(Document): structure = { 'title': unicode, 'body': unicode, 'author': pymongo.objectid.ObjectId, 'created_at': datetime.datetime, 'tags': [unicode], } required_fields = ['title','author', 'date_creation'] blog_post = BlogPost() blog_post['title'] = 'myblogpost' blog_post['created_at'] = datetime.datetime.utcnow() blog_post.save()
  • 59. Mongokit (3/3) Speed andperformanceimpact Mongokitisalwaysbehindthemostcurrentpymongoversions one-man developershow http://namlook.github.com/mongokit/
  • 60. Mongoengine (1/2) MongoEngineis a Document-Object Mapper (think ORM, but fordocumentdatabases) forworkingwithMongoDBfrom Python. Ituses a simple declarative API, similartotheDjango ORM. http://mongoengine.org/
  • 61. Mongokit (2/2) classBlogPost(Document): title = StringField(required=True) body = StringField() author = ReferenceField(User) created_at = DateTimeField(required=True) tags = ListField(StringField()) blog_post = BlogPost(title='myblogpost', created_at=datetime.datetime.utcnow()) blog_post.save()
  • 62. MongoAlchemy (1/2) MongoAlchemyis a layer on top ofthe Python MongoDBdriverwhichadds client-sideschemadefinitions, an easiertoworkwithandprogrammaticquerylanguage, and a Document-Objectmapperwhichallowspythonobjectstobesavedandloadedintothedatabase in a type-safe way. An explicit goalofthisprojectistobeabletoperformasmanyoperationsaspossiblewithouthavingtoperform a load/save cyclesincedoing so isbothsignificantlyslowerandmorelikelytocausedataloss. http://mongoalchemy.org/
  • 63. MongoAlchemy(2/2) frommongoalchemy.documentimportDocument, DocumentField frommongoalchemy.fieldsimport * fromdatetimeimportdatetime frompprintimportpprint class Event(Document): name = StringField() children = ListField(DocumentField('Event')) begin = DateTimeField() end = DateTimeField() def __init__(self, name, parent=None): Document.__init__(self, name=name) self.children = [] ifparent != None: parent.children.append(self)
  • 65. The CAP theorem Consistency Availablity TolerancetonetworkPartitions Pick two...
  • 66. ACID versus Base Atomicity Consistency Isolation Durability BasicallyAvailable Soft state Eventuallyconsistent