Giter Site home page Giter Site logo

cosmic's Introduction

Cosmic

Cosmic

A succinct and powerful command line query tool for Azure Cosmos DB.

Summary

Cosmic makes it effortless to run ad-hoc or prepared queries against your Azure Cosmos DB containers for scenarios such as:

  • Selecting data
  • Upserting data
  • Deleting data
  • Backing up data
  • Troubleshooting performance or cost issues
  • Sharing reusable, parameterisable queries

Cosmic is a tool for operating on existing Azure Cosmos DB collections. If you want to create and modify accounts, databases, and collections, then you should use the official Microsoft Azure CLI tool az cosmosdb.

Installation

dotnet tool install -g cosmic

Usage

Connect to an Azure Cosmos DB account:

cosmic connect -n foo -c "AccountEndpoint=https://****.documents.azure.com:443/;AccountKey=****==;"

Switch to an active container you want to work with (optional):

cosmic switch foo/db/container

Query an Azure Cosmos DB account (where 'foo' is the name of a previously created connection):

cosmic query "SELECT * FROM c"

Delete documents from an Azure Cosmos DB account:

cosmic delete "SELECT * FROM c"

You can pipe data out to a file:

cosmic query "SELECT * FROM c" > data.json

...and then upsert data back in:

cosmic upsert data.json

...or upsert a document directly:

cosmic upsert "{'id':'foo'}"

Measure RU cost:

cosmic query "SELECT * FROM c" -r

Check which container is active:

cosmic active

Store a query for later with default query parameters:

cosmic store -n myquery "SELECT * FROM c WHERE c.Type = '%%'" car

Execute a previously stored query with it's default query parameters:

cosmic query myquery

Execute a previously stored query with defined query parameter values:

cosmic query myquery boat

Output query text before result:

cosmic query myquery boat -q

List connected Azure Cosmos DB accounts:

cosmic accounts

cosmic's People

Contributors

creyke 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.