Warning alert:We're building our new website - with more examples, tips and docs! Some sections though might still be incomplete or under review. When browsing, keep an eye for progress notes and ways to get updated on particular topics.

Code examples

Warning alert:Section under development

This part of our website is still under development and major parts of its content are not published yet.

Follow us on social media to get notified when new content is released.

The Basics

Install dependecies

Add mishmash io to your project:

$ pip install mishmash-io-client

Connect

Import and instantiate:

from Mishmash import Mishmash
 
mishmash = Mishmash()

You are now connected and mishmash will 'hold' all your data as if it was in the local memory of your app.

Info alert:Note

There is no API or framework beyond the simple use of 'local' to your app 'mishmash' variables.

Store Data

To store data, just assign values, arrays and objects to the properties of a mishmash variable:

mishmash.myObjects = {
  "a": 42,
  "b": "a lazy dog",
  "c": [obj1, obj2]
}

That's it - your data is stored and available for later use under mishmash.myObjects.

Info alert:Note

As a database, mishmash io has no schema. It just uses whatever 'schema' you create by the way you organize and store your data.

Access Data

To pull data into your app, just loop over a mishmash variable:

for o in mishmash.myObjects:
  if o.a == 42:
    # do something


The body of the for loop will now operate on your app server with data arriving from the mishmash io cluster. However, remember that this will only run at the speed of your app server and network.

Success alert:Tip

To make your code run faster than that, see the advanced examples below.

Advanced

Building 'mishmashes'

When building 'mishmashes' - those portions of the data that your code needs to work on - you don't have to strictly follow the hierarchy of properties, members and indexes that you created when you stored the data.

To simplify your work, you can grab the data items at any level:

mishmash_b = mishmash.b
mishmash_dogs = mishmash['a lazy dog']

And you can build mishmashes by putting together or slicing apart completely unrelated branches of your data:

cake = mishmash('chocolate', 
                'bananas')
 
coffee = mishmash.coffees.black

Info alert:Note

There's much more that you can do to build mishmashes - scroll down to find out more.

'Query' with code

To achieve super-fast execution of complex logic, don't pull data into the app - instead, push your code into the mishmash io cluster:

def function(input):
  for o in input:
    if o.a == 42:
      # do something complex
 
mishmash.myObjects(function)



The supplied function will now be automatically optimized and 'executed' in parallel across all cluster nodes that contain portions of myObjects and any other input.

Info alert:Note

The code is transformed into a 'parallel' equivalent by combining syntax analysis and knowledge of input data.

Advanced Algorithms

Learn mishmash io through examples.

We developed a little app that analyzes football data to automatically find interesting statistics about the next match.

The details on how we did it are a great place to get started with mishmash io.

Warning alert:This section is being updated

We're currently working on adding more examples.

Follow us on Social Media where we will also publish material on topics like algorithms, Machine Learning, AI and more.

© 2024, Mishmash I O UK Ltd. or its affiliates. All rights reserved. | Privacy Policy | Cookies