mirror of
https://github.com/autistic-symposium/blockchain-data-engineering-toolkit.git
synced 2025-04-26 02:39:15 -04:00
29 lines
600 B
Python
29 lines
600 B
Python
# -*- encoding: utf-8 -*-
|
|
# utils/furnish_db.py
|
|
# Furnish the database with data.
|
|
|
|
import pymongo
|
|
import src.utils.os_utils as os_utils
|
|
|
|
def run():
|
|
|
|
url = "mongodb://localhost:27017/"
|
|
|
|
client = pymongo.MongoClient(url)
|
|
db = client.test
|
|
database_name = client["balances"]
|
|
collection_name = database_name["balances"]
|
|
|
|
|
|
filename = "./balance.json"
|
|
data = os_utils.open_json(filename)
|
|
|
|
|
|
result = []
|
|
for wallet, balance in data.items():
|
|
result.append({"wallet": wallet, "balance": balance})
|
|
|
|
collection_name.insert_many(result)
|
|
|
|
def populate_db():
|
|
pass |