Coder Social home page Coder Social logo

cosmos-db-python-simple-sample's Introduction

このリポジトリについて

  • Azure CosmosDB for MongoDB のPythonによる操作サンプルレポジトリです
  • productsという仮想のjsonデータをpymongoを通じて書き込んだり取得したりします

使い方

1. 依存パッケージのインストール

pin install -r requirements

2. 接続文字列の設定

export COSMOS_CONNECTION_STRING="接続文字列"

接続文字列は CosmosDBインスタンス詳細画面の「クイックスタート」から確認できます

3. 実行

特に引数はありません。回数やクエリ等のパラメータを変更したい場合にはソースを直接変更してください

python define-db-collection-index.py

各ファイルの役割は以下の通りです

  • define-db-collection-index.py

    CosmosDBにDB, adventureworksというDB、productsというcollection、_id列とname列へのインデックス追加を行います。  これ以降のスクリプトはこのスクリプトを実行した後で実行してください

  • input-data.py

    productsに指定件数分のデータを生成しながら投入します。

  • input-data-parallel.py

    productsに指定件数分のデータを生成しながら投入を並列に実行します。

  • get-item-num.py

    products collection内のデータ件数を取得します

  • find-with-index.py

    インデックスのあるname列に文字列を指定して要素取得を行います

  • find-without-index.py

    インデックスのないcity列に文字列を指定して要素取得を行います

  • truncate-data.py

    products collectionの全てのデータを削除します

  • drop-collection.py

    products collectionをcollection定義ごと削除します

  • run-all.py

    dbの作成、データの投入、データの検索を一度に行います

cosmos-db-python-simple-sample's People

Contributors

mizti avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.