Skip to content

Commit

Permalink
add Notebook data model
Browse files Browse the repository at this point in the history
  • Loading branch information
Xu Wang committed Mar 15, 2022
1 parent 5535778 commit ff25c37
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace com.linkedin.metadata.key

/**
* Key for a Notebook
*/
@Aspect = {
"name": "notebookKey",
}
record NotebookKey {
/**
* The name of the Notebook tool such as QueryBook, etc.
*/
@Searchable = {
"fieldName": "tool",
"fieldType": "TEXT_PARTIAL",
"boostScore": 4.0
}
notebookTool: string

/**
* Unique id for the Notebook. This id should be globally unique for a Notebook tool even when there are multiple deployments of it. As an example, Notebook URL could be used here for QueryBook such as 'querybook.com/notebook/773'
*/
notebookId: string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace com.linkedin.notebook

/**
* Chart cell in a notebook, which will present content in chart format
*/
record ChartCell includes CommonCellAttributes {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace com.linkedin.notebook

import com.linkedin.common.ChangeAuditStamps

/**
* Common attributes for a cell in a Notebook
*/
record CommonCellAttributes {

/**
* Title of the cell
*/
cellTitle: string

/**
* Unique id for the cell. This id should be globally unique for a Notebook tool even when there are multiple deployments of it. As an example, Notebook URL could be used here for QueryBook such as 'querybook.com/notebook/773/?cellId=1234'
*/
cellId: string

/**
* Captures information about who created/last modified/deleted this Notebook cell and when
*/
changeAuditStamps: ChangeAuditStamps
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace com.linkedin.notebook

import com.linkedin.common.ChangeAuditStamps

/**
* Stores editable changes made to properties. This separates changes made from
* ingestion pipelines and edits in the UI to avoid accidental overwrites of user-provided data by ingestion pipelines
*/
@Aspect = {
"name": "editableNotebookProperties"
}
record EditableNotebookProperties includes ChangeAuditStamps {
/**
* Edited documentation of the Notebook
*/
@Searchable = {
"fieldType": "TEXT",
"fieldName": "editedDescription",
}
description: optional string
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace com.linkedin.notebook

/**
* A record of all supported cells for a Notebook. Only one type of cell will be non-null.
*/
record NotebookCell {
/**
* The text cell content. The will be non-null only when all other cell field is null.
*/
textCell: optional TextCell,

/**
* The query cell content. The will be non-null only when all other cell field is null.
*/
queryCell: optional QueryCell,

/**
* The chart cell content. The will be non-null only when all other cell field is null.
*/
chartCell: optional ChartCell

/**
* The type of this Notebook cell
*/
type: NotebookCellType
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace com.linkedin.notebook

/**
* Type of Notebook Cell
*/
enum NotebookCellType {

/**
* TEXT Notebook cell type. The cell context is text only.
*/
TEXT_CELL,

/**
* QUERY Notebook cell type. The cell context is query only.
*/
QUERY_CELL,

/**
* CHART Notebook cell type. The cell content is chart only.
*/
CHART_CELL
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace com.linkedin.notebook

/**
* Content in a Notebook
*/
@Aspect = {
"name": "notebookContent"
}
record NotebookContent {
/**
* The content of a Notebook which is composed by a list of NotebookCell
*/
cells: array[NotebookCell] = []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace com.linkedin.notebook

import com.linkedin.common.ChangeAuditStamps
import com.linkedin.common.Url
import com.linkedin.common.CustomProperties
import com.linkedin.common.ExternalReference

/**
* Information about a Notebook
*/
@Aspect = {
"name": "notebookInfo"
}
record NotebookInfo includes CustomProperties, ExternalReference {

/**
* Title of the Notebook
*/
@Searchable = {
"fieldType": "TEXT_PARTIAL",
"enableAutocomplete": true,
"boostScore": 10.0
}
title: string

/**
* Detailed description about the Notebook
*/
@Searchable = {
"fieldType": "TEXT",
"hasValuesFieldName": "hasDescription"
}
description: optional string

/**
* Captures information about who created/last modified/deleted this Notebook and when
*/
changeAuditStamps: ChangeAuditStamps
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace com.linkedin.notebook

import com.linkedin.common.AuditStamp

/**
* Query cell in a Notebook, which will present content in query format
*/
record QueryCell includes CommonCellAttributes {

/**
* Raw query to explain some specific logic in a Notebook
*/
rawQuery: string

/**
* Captures information about who last executed this query cell and when
*/
lastExecuted: optional AuditStamp
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace com.linkedin.notebook

/**
* Text cell in a Notebook, which will present content in text format
*/
record TextCell includes CommonCellAttributes {
/**
* The actual text in a TextCell in a Notebook
*/
@Searchable = {
"fieldType": "TEXT"
}
text: string
}
13 changes: 13 additions & 0 deletions metadata-models/src/main/resources/entity-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ entities:
- domains
- container
- deprecation
- name: notebook
keyAspect: notebookKey
aspects:
- notebookInfo
- notebookContent
- editableNotebookProperties
- ownership
- status
- globalTags
- browsePaths
- institutionalMemory
- domains
- subTypes
- name: corpuser
doc: CorpUser represents an identity of a person (or an account) in the enterprise.
keyAspect: corpUserKey
Expand Down

0 comments on commit ff25c37

Please sign in to comment.