# Cassandra

Cassandra is the primary data store for groups and Redis is used for caching the group API response.

### **Cassandra** Database \[keyspace : sunbird\_groups] <a href="#database" id="database"></a>

**ER diagram**

![](/files/LpviCirGjGXKWkk68poH)

#### Groups Keyspace:

```
CREATE KEYSPACE IF NOT EXISTS sunbird_groups WITH replication = {'class':'SimpleStrategy','replication_factor':1};CREATE TABLE IF NOT EXISTS  sunbird.user(id text,userId text,userName text, email text,phone text,aadhaarNo text,createdDate text,updatedDate text,updatedBy text,
ode
```

**Group Table**

```
CREATE TABLE sunbird_groups.group (
    id text PRIMARY KEY,
    activities list<frozen<map<text, text>>>,
    createdby text,
    createdon timestamp,
    description text,
    membershiptype text,
    name text,
    status text,
    updatedby text,
    updatedon timestamp
);

CREATE INDEX idx_group_status ON sunbird_groups.group (status);
```

**Group\_Member**

```
CREATE TABLE sunbird_groups.group_member (
    groupid text,
    userid text,
    createdby text,
    createdon timestamp,
    removedby text,
    removedon timestamp,
    role text,
    status text,
    updatedby text,
    updatedon timestamp,
    visited boolean,
    PRIMARY KEY (groupid, userid)
);
CREATE INDEX idx_group_member_status ON sunbird_groups.group_member (status);
```

***

**User\_Group**

```
CREATE TABLE sunbird_groups.user_group (
    userid text PRIMARY KEY,
    groupid set<text>
);
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lern.sunbird.org/use/developer-guide/groups/data-models/cassandra.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
