# Path: dbsync/models.py
# class PrefixTables(DeclarativeMeta):
# class ContentType(Base):
# class Node(Base):
# class Version(Base):
# class OperationError(Exception): pass
# class Operation(Base):
#     def __init__(cls, classname, bases, dict_):
#     def __repr__(self):
#     def __init__(self, *args, **kwargs):
#     def __repr__(self):
#     def __repr__(self):
#     def validate_command(self, key, command):
#     def __repr__(self):
#     def references(self, obj):
#     def perform(operation, container, session, node_id=None):


import datetime
from sqlalchemy.orm import sessionmaker
from models import City, House, Person, engine
from dbsync import models




Session = sessionmaker(bind=engine)


# CRUD cities

def create_city(**kwargs):
    session = Session()
    city = City()
    for k, v in kwargs.iteritems():
        setattr(city, k, v)
    session.add(city)
    session.commit()


def update_city(id=None, **kwargs):
    session = Session()
    city = session.query(City).filter(City.id == id).one()
    for k, v in kwargs.iteritems():
        setattr(city, k, v)
    session.commit()



# Path: dbsync/models.py
# class PrefixTables(DeclarativeMeta):
# class ContentType(Base):
# class Node(Base):
# class Version(Base):
# class OperationError(Exception): pass
# class Operation(Base):
#     def __init__(cls, classname, bases, dict_):
#     def __repr__(self):
#     def __init__(self, *args, **kwargs):
#     def __repr__(self):
#     def __repr__(self):
#     def validate_command(self, key, command):
#     def __repr__(self):
#     def references(self, obj):
#     def perform(operation, container, session, node_id=None):


# Path: app-tests/node/controller.py
import datetime
from sqlalchemy.orm import sessionmaker
from models import City, House, Person, engine
from dbsync import models





Session = sessionmaker(bind=engine)


# CRUD cities

def create_city(**kwargs):
    session = Session()
    city = City()
    for k, v in kwargs.iteritems():
        setattr(city, k, v)
    session.add(city)
    session.commit()


def update_city(id=None, **kwargs):
    session = Session()
    city = session.query(City).filter(City.id == id).one()
    for k, v in kwargs.iteritems():
        setattr(city, k, v)
    session.commit()



def delete_city(id=None):