Ingest Data
Inserting a CSV
Below is a short example of how you can insert CSVs via python:
Installing via Python
You can install Twilix's BlitzChain package in Python running the following pip command:
pip install -U blitzchain
After you have installed, you can insert a CSV running the following:
import csv
import json
def csv_to_json(csv_file):
# Read the CSV file
with open(csv_file, 'r') as file:
csv_data = csv.DictReader(file)
# Convert CSV data into a list of dictionaries
data = [row for row in csv_data]
# Return the JSON data
return json.dumps(data)
csv_file = 'input.csv'
# Convert CSV to JSON
json_data = csv_to_json(csv_file)
from blitzchain import Client
client = Client("<YOUR_API_KEY>")
collection = client.Collection("csvSample")
collection.insert_objects(json_data)