Azure Cosmos DB with DBine
How to connect DBine to Azure Cosmos DB and what you can do once it's connected. This page is written from what the Azure Cosmos DB driver says about itself, so it matches the version of DBine you download.
Connect
- In DBine, open New connection.
- Pick Azure Cosmos DB in the list of engines.
- Fill in the fields below, press Test connection and then Save.
Default port: 443.
General
| Field | Description |
|---|---|
| Endpoint required | NoSQL API. For Cosmos DB's API for MongoDB, use the MongoDB driver with the account's connection string. Example: https://account.documents.azure.com:443/ |
| Account key required | Kept in the system keychain, never in DBine's files. |
| Database | |
| Read-only | On or off. |
SSH tunnel. The connection can go through an SSH server, even through a chain of bastions, with a password, a private key or the SSH agent. The server's fingerprint is checked against known_hosts or confirmed the first time.
SSL/TLS
| Field | Description |
|---|---|
| Trust the server certificate | Required for the local emulator (self-signed certificate). On or off. |
What the explorer shows
Under the connection: Databases. Inside each one:
- Containers
Query editor
The editor uses SQL, with completion for the connection's objects. Statements and commands run against the database selected in the tab.
What the editor accepts:
Cosmos DB SQL on a container. Specify the container with a directive:
-- container: products
SELECT TOP 10 * FROM c WHERE c.price > 100 ORDER BY c.price DESC
or with USE products; or by naming it in the FROM: SELECT p.name FROM products p.
Statements separated with «;». Queries are cross-partition.
In addition, DBine understands these statements (the JSON goes exactly as the REST API takes it):
CREATE CONTAINER [IF NOT EXISTS] "products" {
"partitionKey": { "paths": ["/category"], "kind": "Hash" },
"indexingPolicy": {…}, "uniqueKeyPolicy": { "uniqueKeys": [{ "paths": ["/sku"] }] },
"defaultTtl": 3600, "throughput": 400 } (or "autoscaleMaxThroughput": 4000)
DROP CONTAINER [IF EXISTS] "products"
INSERT INTO "products" { "id": "1", "category": "a", "price": 10 }
UPSERT INTO "products" { … } (inserts or replaces by id and partition key)
UPDATE "products" SET { "price": 12 } WHERE { "id": "1" } (changes those fields of the document)
DELETE FROM "products" WHERE { "id": "1" } (deletes that document)
CREATE USER "ana" · DROP USER "ana" (database users, with resource tokens)
GRANT ALL|READ ON "products" TO "ana" · REVOKE ALL|READ ON "products" FROM "ana"
Ready-made templates for new objects:
- New container with hierarchical key
- New container with autoscale
Tools for Azure Cosmos DB
Available
- Graphical execution plans
- Server monitor
- Index usage
- Create databases
- Drop databases
- Database properties
- Visual designer for new objects
- Compare and sync schemas
- Native bulk load when migrating data
- Users and permissions
Not available for Azure Cosmos DB
- Live query profiler
- Sessions and running queries
- End a session
- Locks: who blocks whom
- Cancel another session's query from the sessions list
- Manual transactions (commit and rollback)
- Relations in the ER diagram
- Rename objects
- Clone tables
- Backups
Why a tool doesn't apply to an engine, and the details of each one, are in the engine support reference.
Generated from the Azure Cosmos DB driver 0.1.10, which DBine downloads the first time you connect to Azure Cosmos DB.