This session introduces N1QL and sets the stage for the rich selection of N1QL-related sessions at Couchbase Connect 2015. N1QL is SQL for JSON, extending the querying power of SQL with the modeling flexibility of JSON. In this session, you will get an introduction to the N1QL language, architecture, and ecosystem, and you will hear the benefits of N1QL for developers and for enterprises.
3. #First get all the customers
customerlist = self.customer.find({},{"c_id": 1, "c_name":1 })
#initialize the total list
totlist = set()
#For each customer in customer list
#Create a pipeline to get total order PER CUSTOMER
#Get the SUM of ol_amount for the customer
#Add the customerid, customer name and total to the totlist (list of tuples)
for cl in customerlist:
pipe = [{'$unwind': "$order_line"},
{'$group':{'_id':cl, 'total':{'$sum':'$ol_amount'}}}]
csum = db.orders.aggregate(pipeline=pipe)
totlist.add(cl["c_id"], cl["c_name"], csum["total"])
#sort this full list by the total in the reverse order.
data.sort(key=lambda tup: tup[2], reverse=True)
Application Developers Started
Writing Complex Code for Queries
…With Serious Performance Issues
This session introduces N1QL and sets the stage for the rich selection of N1QL-related sessions at Couchbase
2015. N1QL is SQL for JSON, extending the querying power of SQL with the modeling flexibility of JSON. In this session, you will get an introduction to the N1QL language, architecture, and ecosystem, and you will hear the benefits of N1QL for developers and for enterprises.
N1QL is the query language for JSON. It looks like SQL, walks like SQL, quacks like SQL.
If you know SQL, you’ll know N1QL instantaneously.
With Couchbase 4.0, we’re announcing the language.
Couchbase 4.0 query service implements N1QL. Non First Normal Query Language.
10 + 1 = 11m
Nielsen session and use case
Mention nested sourcing?
Simple One media installation of the cluster.
90 seconds to install!
Data-parallel — Query latency scales up with cores
Memory-bound