CogDB Cloud

CogDB Cloud lets you connect to a managed graph database using an API key. No local storage, no server setup — just pip install cogdb and connect.

Get an API Key

  1. Go to the CogDB Cloud console and sign in with Google.
  2. Click Generate API Key and give it a label.
  3. Copy the key — you won't see it again.

Connect to CogDB Cloud

Pass your API key when creating a graph:

from cog.torque import Graph

g = Graph("movies", api_key="cog_8ab0bc8e8271413d95997fc543f6ffd2")

That's it. All put, get, and traversal operations now run against CogDB Cloud.

Example

from cog.torque import Graph

g = Graph("movies", api_key="cog_8ab0bc8e8271413d95997fc543f6ffd2")

# Add data
g.put("inception", "type", "film")
g.put("inception", "directed_by", "nolan")
g.put("inception", "year", "2010")
g.put("inception", "genre", "sci-fi")
g.put("inception", "stars", "dicaprio")
g.put("inception", "stars", "hardy")

g.put("interstellar", "type", "film")
g.put("interstellar", "directed_by", "nolan")
g.put("interstellar", "year", "2014")
g.put("interstellar", "genre", "sci-fi")
g.put("interstellar", "stars", "mcconaughey")
g.put("interstellar", "stars", "hathaway")

g.put("dark_knight", "type", "film")
g.put("dark_knight", "directed_by", "nolan")
g.put("dark_knight", "genre", "action")
g.put("dark_knight", "stars", "bale")
g.put("dark_knight", "stars", "ledger")

g.put("dicaprio", "type", "actor")
g.put("hardy", "type", "actor")
g.put("nolan", "type", "director")

# All films Nolan directed
g.v("nolan").inc("directed_by").all()
# → {'result': [{'id': 'inception'}, {'id': 'interstellar'}, {'id': 'dark_knight'}]}

# All actors in Inception
g.v("inception").out("stars").all()
# → {'result': [{'id': 'dicaprio'}, {'id': 'hardy'}]}

# 2-hop: Who directed the films DiCaprio is in?
g.v("dicaprio").inc("stars").out("directed_by").all()
# → {'result': [{'id': 'nolan'}]}

# All sci-fi films
g.v().has("genre", "sci-fi").all()
# → {'result': [{'id': 'inception'}, {'id': 'interstellar'}]}

Cloud vs Local

LocalCloud
SetupGraph("name")Graph("name", api_key="cog_...")
StorageLocal filesystemCogDB Cloud
APISame Torque APISame Torque API
Use casePrototyping, embedded appsProduction, shared access, multi-client

The Torque query API is identical in both modes. Switching from local to cloud requires only adding the api_key parameter.

Managing API Keys

Visit the Cloud console to:

  • Generate new API keys with custom labels
  • View all your active keys
  • Delete keys you no longer need

Each key is shown in masked form (cog_...last8chars) after creation. The full key is displayed only once at generation time — store it securely.

On this page