Skip to main content

The transform method

The transform method places the existing value of a Node into a dictionary under a user-defined key. This way, you can create new Nodes inside your existing one.

Command usage:

PYNdatabase.transform(name, new_name)
PYNdatabase.Node.transform(name, new_name)

 

This method can be easily understood with the aid of a before and after diagram:

Before

None

After

{'new_name': None}

 

Examples:

Basic usage:

from pyndb import PYNDatabase
db = PYNDatabse('filename.pyndb')
db.set('hello', 'world')
db.transform('hello', 'example') # <--
print(db.example.hello.val)