Mukesh Sakre
Mukesh Sakre

Reputation: 156

Stargate Graphql query to fetch related record from ASTRA DB

My database is ASTRA DB (Casasndra) and I am using Stargate Graphql gateway to interact with astra DB. For client I am using Postman for query and mutation. I have created 2 tables using below mutation from postman:

  namespace : createTable(
    keyspaceName: "{{gkeyspace}}"
    tableName: "T_Namespace"
    partitionKeys: [{ name: "namespace_name", type: { basic: TEXT } }]
    clusteringKeys: [{ name: "namespace_id", type: { basic: UUID } }]
    values: [
      { name: "namespace_desc", type: { basic: TEXT } }
      { name: "audit_info", type: { basic: UDT, info: {name:"audit_info"}}}
    ]
  )
  partition : createTable(
    keyspaceName: "{{gkeyspace}}"
    tableName: "T_Partition"
    partitionKeys: [{ name: "partition_name", type: { basic: TEXT } }]
    clusteringKeys: [{ name: "partition_id", type: { basic: UUID } }]
    values: [
      { name: "partition_desc", type: { basic: TEXT } }
      { name: "namespace_id", type: { basic: UUID } }
      { name: "audit_info", type: { basic: UDT, info: {name:"audit_info"}}}
    ]
  )
}

I would like to know the graphql query to fetch records from T_Namespace table and related records from T_Partition table based on namespace_id present in the T_Partition table.

  1. Please help to share graphql query.
  2. Is it a good cassandra table design? if not how to do it?

Upvotes: 0

Views: 37

Answers (0)

Related Questions