digital-science / dimcli

Python client and CLI for scientometrics and research analytics using the Dimensions API.
https://digital-science.github.io/dimcli/getting-started.html
MIT License
43 stars 6 forks source link

Allow to save/load query results #49

Closed lambdamusic closed 3 years ago

lambdamusic commented 4 years ago

Similar to what pickle does with Python objects.

lambdamusic commented 4 years ago
res = dsl.query(q)

# save

import pickle
with open('filename.pickle', 'wb') as handle:
    pickle.dump(res, handle)

# => can be packed into res.save(filename) 

Then loading

# full syntax
with open('filename.pickle', 'rb') as handle:
    b = pickle.load(handle)

# => can be packed into 

dsl.load(b) # => returns a dimcli.core.api.Result() object preloaded with data
lambdamusic commented 3 years ago

https://digital-science.github.io/dimcli/modules.html#dimcli.core.api.DslDataset.to_json_file