import sys
sys.path.append('/Volumes/Sandisk/Projects/bravaorm')
import bravaorm
from model import *

def test():
    conn = bravaorm.Connection(db_user="root", db_password="root", db_host="localhost", db_port=3306, db_database="gofans")
    
    users = conn.blackwords.where("id>30").all
    for usr in users:
        # Note: no conn.add() anymore!
        usr.bla_word = "muda3"
        print(usr.toJSON())
        
    print(f"Queue count before save: {len(conn.__queue__['add'])}")
    conn.save()
    
    users2 = conn.blackwords.where("id>30").all
    for usr in users2:
        print(f"Verified DB: {usr.toJSON()}")

if __name__ == "__main__":
    test()
