<commit_before>Quickstart
==========

After you've installed libtree correctly, you can create the table schema and create some nodes::

    from libtree import *

    # Connect to Postgres and create tables
    per = PostgreSQLPersistance("dbname=test_tree user=vortec")
    per.install()

    # Create a few nodes to get going
    root = insert_node(per, None, 'folder', attributes={'title': 'Root node'})
    bin = insert_node(per, root, 'folder', attributes={'title': 'Binary folder'})
    etc = insert_node(per, root, 'folder', attributes={'title': 'Config folder'})
    bash = insert_node(per, etc, 'file', attributes={'title': 'Bash executable'})
    hosts = insert_node(per, etc, 'file', attributes={'title': 'Hosts file'})
    passwd = insert_node(per, etc, 'file', attributes={'title': 'Password file'})

    # Get direct children of root node
    children = list(get_children(per, root))
    print(children)
    # Output:
    # [<Node id=2, title='Binary folder'>, <Node id=3, title='Config folder'>]

    # Move bash node into correct parent node
    change_parent(per, bash, bin)

    # Print entire tree
    print_tree(per)
    # Output:
    # <Node id=1, title='Root node'>
    #   <Node id=2, title='Binary folder'>
    #     <Node id=4, title='Bash executable'>
    #   <Node id=3, title='Config folder'>
    #     <Node id=5, title='Hosts file'>
    #     <Node id=6, title='Password file'>

    # Commit transaction
    per.commit()<commit_msg>use new insert_node() signature in quickstart docs<commit_after>Quickstart
==========

After you've installed libtree correctly, you can create the table schema and create some nodes::

    from libtree import *

    # Connect to Postgres and create tables
    per = PostgreSQLPersistance("dbname=test_tree user=vortec")
    per.install()

    # Create a few nodes to get going
    root = insert_node(per, None, properties={'title': 'Root node'})
    bin = insert_node(per, root, properties={'title': 'Binary folder'})
    etc = insert_node(per, root, properties={'title': 'Config folder'})
    bash = insert_node(per, etc, properties={'title': 'Bash executable'})
    hosts = insert_node(per, etc, properties={'title': 'Hosts file'})
    passwd = insert_node(per, etc, properties={'title': 'Password file'})

    # Get direct children of root node
    children = list(get_children(per, root))
    print(children)
    # Output:
    # [<Node id=2, title='Binary folder'>, <Node id=3, title='Config folder'>]

    # Move bash node into correct parent node
    change_parent(per, bash, bin)

    # Print entire tree
    print_tree(per)
    # Output:
    # <Node id=1, title='Root node'>
    #   <Node id=2, title='Binary folder'>
    #     <Node id=4, title='Bash executable'>
    #   <Node id=3, title='Config folder'>
    #     <Node id=5, title='Hosts file'>
    #     <Node id=6, title='Password file'>

    # Commit transaction
    per.commit()
{'fraction_non_alphanumeric': 0.1436919903746992, 'fraction_numerical': 0.005500171880371262, 'mean_word_length': 3.762684124386252, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5255503', 'n_tokens_mistral': 902, 'n_tokens_neox': 882, 'n_words': 277}