Azure Cosmos DB CSV upload

Viewed 286

I am opening a CSV file in Python in Pycharm, then I want to upload it to my Container in Cosmos DB. It's not working.

if os.path.exists(csv_file):
    with codecs.open(csv_file, 'rb', encoding="utf-8") as csv:
        csv_reader = DictReader(csv)
        for row in csv_reader:
            upsert_item(row)

Can I just open a CSV file, then upload it to CosmosDB like the above and below? It's not working.

def upsert_item(row):
     container.upsert_item(row)
1 Answers
Related