Gudu SQLFlow Product Docs
  • 1. Introduction
    • What is Gudu SQLFlow?
      • What SQLFlow can do
      • Architecture Overview
    • Getting Started
      • Sign up a new account
        • Team Management
        • Delete My Account
        • Activate by entering a coupon
      • How to use SQLFlow
      • Different modes in Gudu SQLFlow
        • Query mode
        • Job mode
      • Basic Usage
      • Convert SQL to E-R Diagram
      • Colors in SQLFlow Diagram
      • Show call relationship
    • Installation
      • Version and Users
        • Cloud and On-Premise version
        • SQLFlow before Version 6
          • For older version SQLFlow under Linux
          • For older version SQLFlow under MacOS
          • For older version SQLFlow under Windows
      • Linux
      • MacOS
      • Windows
      • Docker
      • Clickhouse Installation
        • Clickhouse For CentOs
        • Clickhouse For Ubuntu/Debian/RHEL
      • Troubleshooting
      • Upgrade
      • Third Party Components
      • Renew License File
    • UI
      • SQLText Editor
      • Schema Explorer
      • Diagram Panel
      • Settings
      • Job Management
        • Job Sources
    • Dlineage Tool
      • Overview
      • Usage
        • Analyze data linege from SQL files
        • Analyze data linege from a database
        • Resolve the ambiguous columns in SQL query
        • Map the DataFlowAnalyzer and the settings on SQLFlow UI
        • Settings
      • Dataflow.xml structure
      • FAQ
  • 2. CONCEPTS
    • Data Lineage Basics
      • Dataflow
        • Relations generated by SQLFlow
      • Direct Dataflow
      • Indirect Dataflow
      • Aggregate function and Dataflow
      • Dataflow chain
    • Data Lineage Format Reference
  • 3. API Docs
    • Prerequisites
    • Using the Rest API
    • SQLFlow Rest API reference
      • User Interface
      • Generation Interface
        • /sqlflow
        • /sqlflow/selectedgraph/table_level_lineage
        • /sqlflow/selectedgraph/image
        • /sqlflow/graph
        • /sqlflow/graph/table_level_lineage
        • /sqlflow/graph/image
        • /sqlflow/downstreamGraph
        • /sqlflow/upstreamGraph
        • /sqlflow/erdiagramSelectGraph
        • /sqlflow/leftMostSourceTableGraph
      • Job Interface
        • /submitUserJob
        • /displayUserJobSummary
        • /displayUserJobsSummary
        • /exportLineageAsJson
        • /exportFullLineageAsJson
        • /exportLineageAsGraphml
        • /submitPersistJob
        • /displayUserLatestJobTableLevelLineage
      • Export Image
      • Export CSV
        • /sqlflow/exportFullLineageAsCsv
        • /job/exportFullLineageAsCsv
    • Swagger UI
    • Export the data lineage result
    • Python
      • Basic Usage
      • Advanced Usage
    • SQL Parser API
      • checkSyntax
  • 4. SQLFlow Widget
    • Widget Get started
    • Usages
    • Widget API Reference
  • 5. Databases
    • Database Objects
      • Azure
      • DB2
  • 6. SQLFlow-ingester
    • Introduction
      • SQLFlow-Exporter
      • SQLFlow-Extractor
      • SQLFlow-Submitter
    • Get Started
      • SQL Server
    • SQLFlow-Ingester Java API Usage
    • Understand the format of exported data
      • Oracle
      • Microsoft SQL Server
      • MySQL
      • PostgreSQL
    • List of Supported dbVendors
    • Git Repo
    • Third Party Components
  • 7. Reference
    • Lineage Model
      • Json Format Lineage Model
      • XML Format Lineage Model
      • Data Lineage Elements
    • Database Model
  • 8. other
    • FAQ
      • Handling Internal Database
      • Delete Your Account
      • Table Form Data Without Intermediates
      • Not all schema exported from Oracle
      • Lineage Customization
    • Roadmap
    • SQL Samples
      • Exchange table partition
      • Generate relationship for renamed table
      • Snowflake table function lineage detection
    • Change Logs
    • SQLFlow with Oracle XML functions
    • Major Organizations Utilizing SQLFlow
Powered by GitBook
On this page
  • Get Lineage Model
  • The Dbobjs
  • The Relationships
  • Visualization
  1. 8. other
  2. FAQ

Lineage Customization

PreviousNot all schema exported from OracleNextRoadmap

Last updated 9 months ago

SQLFlow enables the customization of the data lineage in case users need to build their own visual representaiton of the query making it more comprehensible for non DBA people.

Let's take a simple query as an example:

TABLE1.A -> TABLE2.B

Get Lineage Model

All SQLFlow lineages can be represented under the lineage model structure. It can either be in Json format or in XML format. Please refer to to read the details information for the lineage mode.

There are several ways to retrieve the SQLFlow lineage mode:

  1. Invoking REST APIs, for example will give the lineage model.

  2. Using GSP

  3. DIrectly copy the lineage model value from SQLFlow Web

A Json/XML format SQLFlow lineage model is now available:

{
  "dbobjs": {
  "createdBy": "sqlflow",
    "servers": [
      {
        "name": "DEFAULT_SERVER",
        "dbVendor": "dbvoracle",
        "supportsCatalogs": true,
        "supportsSchemas": true,
        "databases": [
          {
            "name": "DEFAULT",
            "schemas": [
              {
                "name": "DEFAULT",
                "tables": [
                  {
                    "id": "10",
                    "name": "table1",
                    "displayName": "table1",
                    "type": "table",
                    "columns": [
                      {
                        "id": "11",
                        "name": "a"
                      }
                    ]
                  },
                  {
                    "id": "4",
                    "name": "table2",
                    "displayName": "table2",
                    "type": "table",
                    "columns": [
                      {
                        "id": "5",
                        "name": "b"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "relationships": [
    {
      "id": "1",
      "type": "fdd",
      "target": {
        "id": "5",
        "column": "B",
        "parentId": "4",
        "parentName": "TABLE2"
      },
      "sources": [
        {
          "id": "11",
          "column": "A",
          "parentId": "10",
          "parentName": "TABLE1"
        }
      ]
    }
  ]
}

The Dbobjs

dbobjs lists all data objects, and it is the data source of relationships. The target and source in relationships are all in the dbobjs.

{
  "createdBy": "sqlflow",//hard coded value to distinguish the json version
    "servers": [
      {
        "name": "DEFAULT_SERVER",//server name
        "dbVendor": "dbvoracle"//db type
        "supportsCatalogs": true,
        "supportsSchemas": true,
        "databases": [
          {
            "name": "DEFAULT",//database type, use default value if no database
            "schemas": [
              {
                "name": "DEFAULT",//schema name, use default value if no schema
                "tables": [
                  {
                    "id": "10",//table ID
                    "name": "table1",//table name 
                    "type": "table",//type, table or view
                    "columns": [
                      {
                        "id": "11",// column ID
                        "name": "a"//column name
                      }
                    ]
                  },
                  {
                    "id": "4",
                    "name": "table2",
                    "type": "table",
                    "columns": [
                      {
                        "id": "5",
                        "name": "b"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }

The Relationships

relationships has all data lineage relationships. The neighborhoring lineage of each field is regarded as one item. The target and source of each relationship can be found in dbobjs. You can customize your own lineage by updating this object.

 [
    {
      "id": "1",//Unique identifier
      "type": "fdd",//lineage type
      "target": {//target object in the lineage, only 1 target in one lineage 
        "id": "5",//field identifier, column.id of the dbobjs
        "column": "B",//column.name
        "parentId": "4",//The table/view ID where the data field is located, corresponding to table.id of dbobjs
        "parentName": "TABLE2"//The name of the table/view where the data field is located, corresponding to table.name in dbobjs
      },
      "sources": [//source of the lineage, can be multiple
        {
          "id": "11",//columns.id
          "column": "A",//Data field name, corresponding to the column.name in dbobjs
          "parentId": "10",//The table/view ID where the data field is located, corresponding to table.id of dbobjs
          "parentName": "TABLE1"//The name of the table/view where the data field is located, corresponding to table.name in dbobjs
        }
      ]
    }
  ]

Note that:

  • Id type of the object should be int

  • Ensure the uniqueness of the id. Duplicate id makes error in the syntax.

Visualization

Paste the updated lineage mode(Json/XML) in the query editor of the SQLFlow Web and it generates the updated graph:

You can change the display configuration and export the image files with SQLFlow Web.

Please check if more detailed information is required.

https://docs.gudusoft.com/7.-reference/lineage-model
this page
/sqlflow/graph
https://docs.gudusoft.com/1.-introduction/java-library