调用atlas中的api,上传元数据

使用的api地址

http://ip:21001/api/atlas/v2/entity
请求方式post

创建数据库实例
{
    "entity": {
        "typeName":   "rdbms_instance",
        "attributes": {
            "qualifiedName": "192.168.0.45@mysql@instance",
            "name":          "192.168.0.45@mysql",
            "rdbms_type":"MYSQL",
            "platform":"win10",
            "cloudOrOnPrem":"cloud",
            "hostname":"192.168.0.45",
            "port":"3306",
            "protocol":"http",
            "contact_info":"jdbc",
            "comment":"rdbms_instance API insert test",
            "description":"rdbms_instance描述",
            "owner":"root"
        }
    }
}

//返回的数据中得到guid

guid: "d826c778-041c-464c-ad2b-08b472de8028"

//创建数据源,并关联数据实例

{
"entity": { "typeName": "rdbms_db", "attributes": { "qualifiedName": "192.168.0.45@mysql@datag", "owner": "root", "ownerType":"USER", "name": "datag", "emailAddress": "caozqa", "createdBy": "caozqaAPI", "createTime": "2017-08-25T13:15:25.369Z", "updatedBy": "caozqa", "updateTime": "2017-08-25T14:12:45.246Z", "description": "rdbms_db datag API input", "prodOrOther":"44", "version":0, "contact_info":"111", "instance":{ "guid": "d826c778-041c-464c-ad2b-08b472de8028", "typeName": "rdbms_instance" } } } }

guid: "2c696415-c1f0-47b6-b779-94f7d6ba68c5"

 
//创建数据表
{
    "entity": {
        "typeName":   "rdbms_table",
        "attributes": {
            "qualifiedName": "mysql_table_01@datag@192.168.0.45",
            "createdBy":     "root",
            "createTime":    "2017-08-25T13:15:25.369Z",
            "updatedBy":     "root",
            "updateTime":    "2017-08-25T14:12:45.246Z",
            "name":          "mysql_table_01",
            "comment":"rdbms_table API insert test",
            "description":"rdbms_table  手动输入",
            "owner":"root",
            "type":"table",
            "contact_info":"mysql_table_01_info",
            "db": {
                "guid": "2c696415-c1f0-47b6-b779-94f7d6ba68c5",
                "typeName": "rdbms_db"
            }
        }
    }
}
"guid": "e97f1cf2-944e-4f10-9bc3-1d8ed83fb829"

 

 
 
//创建数据字段
"guid": "c023757d-438b-462b-ae58-e90a4c4879e5" 
{
    "entity": {
        "typeName":   "rdbms_column",
        "attributes": {
            "qualifiedName": "id@mysql_table_01@datag@192.168.0.45",
            "createdBy":     "root",
            "createTime":    "2017-08-25T13:15:25.369Z",
            "updatedBy":     "root",
            "updateTime":    "2017-08-25T14:12:45.246Z",
            "name":          "id",
            "comment":"rdbms_column API insert test",
            "description":"rdbms_column  手动输入",
            "owner":"root",
            "data_type":"String",
            "length":20,
            "default_value":0,
            "isNullable":false,
            "isPrimaryKey":true,
            "table": {
                "guid": "e97f1cf2-944e-4f10-9bc3-1d8ed83fb829",
                "typeName": "rdbms_table"
            },
            "contact_info":"id_info"
        }
    }
}

创建血缘,需有输入和输出的guid

input
{
    "typeName": "hive_table",
    "attributes": {
        "owner": "hue",
        "createTime": 1603778095000,
        "qualifiedName": "etl.ods_dcs_etl_test1@primary",
        "name": "ods_dcs_etl_test1"
    },
    "guid": "69b56081-2926-41d8-a30b-e46b63e66a89",
    "status": "ACTIVE",
    "displayText": "ods_dcs_etl_test1",
    "classificationNames": [],
    "classifications": [],
    "meaningNames": [],
    "meanings": []
}
output
{
            "typeName": "rdbms_table",
            "attributes": {
                "owner": "caozqa",
                "createTime": 1503666925369,
                "qualifiedName": "table_035@datag@10.10.66.29",
                "name": "table_035",
                "description": "rdbms_table  手动输入"
            },
            "guid": "2127a961-c3ae-4138-b41a-c0cd2f6aff9c",
            "status": "ACTIVE",
            "displayText": "table_035",
            "classificationNames": [],
            "classifications": [],
            "meaningNames": [],
            "meanings": []
        }

 

 

//创建血缘关系


{
    "entity": {
        "typeName": "Process",
        "attributes": {
            "qualifiedName": "hive2mysql_table_01@datag@192.168.0.45",
            "createdBy": "root",
            "createTime": "2017-08-25T13:15:25.369Z",
            "updatedBy": "caozqaAPI",
            "updateTime": "2017-08-25T14:12:45.246Z",
            "name": "hive_table-TO-rdbms_table",
            "comment": "hive关联mysql",
            "description": "hive关联mysql",
            "owner": "caozqa",
            "type": "table",
            "contact_info": "hive_table-TO-rdbms_table",
            "inputs": [
                {
                    "guid": "69b56081-2926-41d8-a30b-e46b63e66a89",
                    "typeName": "hive_table"
                }
            ],
            "outputs": [
                {
                    "guid": "2127a961-c3ae-4138-b41a-c0cd2f6aff9c",
                    "typeName": "rdbms_table"
                }
            ]
        }
    }
}
"guid": "49c6dc94-25f6-485f-bbc4-738102750651"

 

参考文章:https://blog.csdn.net/czq850114000/article/details/96438798



调用atlas中的api,上传元数据

上一篇:C# (Winform) Enable和visible的区别


下一篇:Windows Server 2016 如何恢复.NET Framework 4.6