Examples from the tutorial

Examples from /tutorial/tut01

Example 1

extract()[source]
load(x)[source]
transform(x)[source]

Example 2

Examples from /tutorial/tut02

Example 1: Read

get_services()[source]

Example 2: Write

get_services()[source]
split_one(line)[source]

Example 3: Write as map

class MyJsonWriter(*args, **kwargs)[source]

Bases: bonobo.nodes.io.json.JsonWriter

Parameters:
  • path (str) – Path to use within the provided filesystem.
  • eol (str) –

    Character to use as line separator.

    Default: ‘n’

  • encoding (str) –

    Encoding.

    Default: ‘utf-8’

  • fs (str) –

    The filesystem instance to use.

    Default: ‘fs’

  • mode (str) –

    What mode to use for open() call.

    Default: ‘w+’

Custom instance builder. If not all options are fulfilled, will return a PartiallyConfigured instance which is just a functools.partial object that behaves like a Configurable instance.

The special _final argument can be used to force final instance to be created, or an error raised if options are missing.

Parameters:
  • args
  • _final – bool
  • kwargs
Returns:

Configurable or PartiallyConfigured

write(fs, file, lineno, **row)[source]

Write a json row on the next line of file pointed by ctx.file.

Parameters:
  • ctx
  • row
prefix = '{'
suffix = '}'
get_services()[source]
split_one_to_map(line)[source]