def add_file(new_file_info): dbpath = osp.join(root_dir, config.wallet.dbpath) engine = create_engine('sqlite:///{dbpath}'.format(dbpath=dbpath), echo=True) Session = sessionmaker(bind=engine) session = Session() session.add(new_file_info) session.commit()
def get_file_list(): """This returns a list of files. """ dbpath = join_with_rc(config.wallet.dbpath) engine = create_engine('sqlite:///{dbpath}'.format(dbpath=dbpath), echo=True) Session = sessionmaker(bind=engine) session = Session() return session.query(FileInfo).all()
def publish_file_update(market_hash, selected_id): dbpath = osp.join(root_dir, config.wallet.dbpath) engine = create_engine('sqlite:///{dbpath}'.format(dbpath=dbpath), echo=True) Session = sessionmaker(bind=engine) session = Session() session.query(FileInfo).filter(FileInfo.id == selected_id + 1). \ update({FileInfo.market_hash: market_hash, FileInfo.is_published: True}, synchronize_session=False) session.commit()