Query for retrieving database schema details in GraphQL API endpoint

Original Slack Thread

Hi All

Can someone please give me a graphql /api endpoint which will give the details about all the tables–>columns and description of the columns for a particular database–>schema

Hey there! :wave: Make sure your message includes the following information if relevant, so we can help more effectively!

  1. Which DataHub version are you using? (e.g. 0.12.0)
  2. Please post any relevant error logs on the thread!
  dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:mysql,test_db.sst.customer_data,PROD)") {
    ...datasetSchema
    siblings {
      isPrimary
      siblings {
        urn
        type
        ... on Dataset {
          ...datasetSchema
        }
      }
    }
  }
}

fragment datasetSchema on Dataset {
  schemaMetadata(version: 0) {
    ...schemaMetadataFields
  }
  editableSchemaMetadata {
    editableSchemaFieldInfo {
      fieldPath
      description
    }
  }
  editableProperties {
    description
  }
}

fragment schemaMetadataFields on SchemaMetadata {
  createdAt
  datasetUrn
  name
  platformUrn
  platformSchema {
    ... on TableSchema {
      schema
    }
    ... on KeyValueSchema {
      keySchema
      valueSchema
    }
  }
  fields {
    ...schemaFieldFields
  }
  primaryKeys
}

fragment schemaFieldFields on SchemaField {
  fieldPath
  label
  jsonPath
  nullable
  description
  type
  nativeDataType
  recursive
  isPartOfKey
}```

please check out the <How To Set Up GraphQL | DataHub explorer> to discover more about what you can query on datahub.