Skip to content

GraphtyLove/azure_cosmosDB_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure CosmosDB

In this repo, you will find code to interact in python with Azure CosmosDB.

Why?

It has been created for the purpose of a Use-Case project in a BeCode AI class. (Bouman4)

Provide read access to learners

To provide a read-only access to the learners you can give them the credentials that are stored in:

Azure -> CosmosDB -> <Your Cosmos instance> -> Keys -> Read-Only Keys.

The PRIMARY READ-ONLY CONNECTION STRING should be enough, but you can also provide the URI and the PRIMARY READ-ONLY KEY.

Installation

In order for the project to run, you need to:

Install python 3.9.2

Install the requirements with:

pip install -r requirements.txt

Then you need to create a .env file at the root of the project and add the following keys:

DB_NAME=<YOUR DB NAME> # You need to create this one in: `Azure` -> `CosmosDB` -> <your Cosmos Instance> -> `Create`
DB_URL=<YOUR DATABSE URL> # See Azure portal: `Azure` -> `CosmosDB` -> <your Cosmos Instance> -> `Keys` -> `URI`
DB_SECRET=<YOUR PRIMARY KEY> # See Azure portal: `Azure` -> `CosmosDB` -> <your Cosmos Instance> -> `Keys`-> `PRIMARY KEY`

Files

Data

The data are divided in 6 .csv files:

Import data

In import_data.py you will find the code used to import the data (.csv format) in CosmosDB.

Read Database

In read_database.py you will find the code used to read a table from the databse in CosmosDB.

Resources

To write this code I used some resources:

Who?

Written by Maxim Berge the 14/03/2022.

About

Code to interact with Azure CosmosDB python SDK. Becode Accenture Project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages