Created
August 2, 2020 15:18
-
-
Save ashee/c25519ae76a8cd19a81e6f698fb7ff26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import dask.bag as db | |
import json | |
from boto3.dynamodb.types import TypeDeserializer | |
def load_json(data): | |
doc = json.loads(data) | |
items = doc['Items'] | |
d = TypeDeserializer() | |
return {k: d.deserialize(v) for item in items for k, v in item.items()} | |
if __name__ == "__main__": | |
ddb_data_file = "data/*.json" | |
b = db.read_text(ddb_data_file).map(load_json) | |
print(b.take(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment