from tables import Satellite
import pykit.library.sqlkit as sql_kit

dao = sql_kit.Dao('mysql+pymysql://root:lhr@192.168.0.210:3306/test')
sat = Satellite()
# sat.norad = '25547'
# dao.Add(sat)
sat.norad = '25544'
sat.cnName = '86645'

# V=sat.to_dict()
# for k,v in list(V.items()):
#      if k==sat.getPK():
#           del V[k]
#      if v == None:
#           del V[k]
#
# session=dao.session
# session.query(Satellite).filter(Satellite.norad ==sat.norad).update(V, synchronize_session=False)
# session.commit()

dao.Update(Satellite, sat, Satellite.norad == sat.norad)
# dao.Del(Satellite,Satellite.norad==sat.norad)

dao.session.close()
