Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pybman import Client
- from pybman import DataSet
- # create client instance
- client = Client(secret="conf/secret.json")
- # retrieve data of given contexts
- import_context = client.get_data(ctx_id='ctx_906588')
- productive_context = client.get_data(ctx_id='ctx_924547')
- # combine records of contexts
- records = import_context.records + productive_context.records
- # create data set for collected records
- total = DataSet(data_id="eth-mpg", raw=records)
- # create data set for released records
- data_set = DataSet(data_id="eth-mpg_released", raw=total.get_items_released())
- new_source_genre = 'BOOK'
- old_source_genre = 'ENCYCLOPEDIA'
- book_items = ["item_1945574", "item_1945576", "item_1945580", "item_1729057", "item_1729060", "item_1729062", "item_1729066", "item_1302005", "item_922769", "item_922771", "item_923570"]
- collection = []
- for item_id in book_items:
- rec = data_set.get_item(item_id)
- collection.append(rec)
- encyclo = DataSet(data_id="encyclopdia_items", raw=collection)
- updated = client.change_source_genre(new_source_genre, old_source_genre, encyclo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement