{"id":2663,"date":"2023-02-12T09:50:12","date_gmt":"2023-02-12T14:50:12","guid":{"rendered":"https:\/\/www.dpriver.com\/blog\/?p=2663"},"modified":"2023-02-23T10:24:03","modified_gmt":"2023-02-23T15:24:03","slug":"wiget","status":"publish","type":"post","link":"https:\/\/www.dpriver.com\/blog\/2023\/02\/wiget\/","title":{"rendered":"Embed the data lineage generated by SQLFlow on your own website"},"content":{"rendered":"\n

If you are looking for a tool to dynamically embed your data lineage into your own website, SQLFlow Widget<\/a> would be a good choice.<\/p>\n\n\n\n

The SQLFlow Widget is a Javascript library that enables instantaneous data lineage visualisation on your website. SQLFlow Widget works together with the Gudu SQLFlow backend in order to visualize the data lineage and provides an actionable diagram.<\/p>\n\n\n\n

The SQLFlow widget is shipped together with the SQLFlow On-Premise version<\/a>. Once the SQLFlow Widget is installed on your server, you can access the SQLFlow widget with the Url: https:\/\/127.0.0.1\/widget<\/a>. Currently there are no online demos available.<\/p>\n\n\n\n

<\/figure>\n\n\n\n

- Visualize the lineage of the SQL queries.<\/li><\/ul>\n\n\n\n
  - Show specific table\/column lineage graphics on the web page.<\/li><\/ul>\n\n\n\n
    - Package the data lineage into a standalone web app.<\/li><\/ul>\n\n\n\n
      - Shipped together with the SQLFlow On-Premise<\/a> version.<\/li><\/ul>\n\n\n\n

        ## Files<\/h2>\n\n\n\n

        ##

            \u251c\u2500\u2500 index.html\n\u251c\u2500\u2500 jquery.min.js\n\u251c\u2500\u2500 sqlflow.widget.2.4.9.css\n\u2514\u2500\u2500 sqlflow.widget.2.4.9.js\n\u2514\u2500\u2500 1\\\n\u2514\u2500\u2500 2\\\n\u2514\u2500\u2500 3\\\n\u2514\u2500\u2500 ...<\/code><\/pre>\n\n\n\nPlease note that the version number in the file may change. Folders from number 1 to number 15 are example codes.<\/p>\n\n\n\nSetup<\/a><\/h2>\n\n\n\nImport the sqlflow.widget.2.4.9.js<\/code> in index.html. During the execution of the JS, a new iframe will be created. The css<\/code> is statically imported by js<\/code> and will be embedded into the iframe so no additional css import is required.<\/p>\n\n\n\njquery is optional and is included here only for the demostration purpose.<\/p>\n\n\n\n<!DOCTYPE html>\n<html lang=\"en-us\">\n    <head>\n        <meta charset=\"UTF-8\" \/>\n        <title>demo\uff1avisualize sqltext<\/title>\n        <script src=\"\/widget\/jquery.min.js\"><\/script>\n        <script src=\"\/widget\/sqlflow.widget.3.0.4.js?t=1667100085601\"><\/script>\n        <script src=\"index.js\"><\/script>\n        <style>\n            body {\n                padding: 20px;\n            }\n\n            h1 {\n                margin-top: 20px;\n                font-size: 24px;\n            }\n        <\/style>\n    <\/head>\n\n    <body>\n        <h1>demo\uff1avisualize sqltext<\/h1>\n        <div id=\"sqlflow\"><\/div>\n    <\/body>\n<\/html>\n<\/code><\/pre>\n\n\n\nInsert the following code in index.js:<\/p>\n\n\n\n$(async () => {\n    \/\/ get a instance of SQLFlow\n    const sqlflow = await SQLFlow.init({\n        container: document.getElementById('sqlflow'),\n        width: 1000,\n        height: 315,\n        apiPrefix: 'http:\/\/xxx.com\/api',\n        token: '', \/\/ input your token\n    });\n\n    \/\/ set dbvendor property\n    sqlflow.vendor.set('oracle');\n\n    \/\/ set sql text property\n    sqlflow.sqltext.set(`CREATE VIEW vsal \n    AS \n      SELECT a.deptno                  \"Department\", \n             a.num_emp \/ b.total_count \"Employees\", \n             a.sal_sum \/ b.total_sal   \"Salary\" \n      FROM   (SELECT deptno, \n                     Count()  num_emp, \n                     SUM(sal) sal_sum \n              FROM   scott.emp \n              WHERE  city = 'NYC' \n              GROUP  BY deptno) a, \n             (SELECT Count()  total_count, \n                     SUM(sal) total_sal \n              FROM   scott.emp \n              WHERE  city = 'NYC') b \n    ;`);\n\n    sqlflow.visualize();\n});<\/code><\/pre>\n\n\n\nWith the above code we will have a result:<\/p>\n\n\n\n<\/figure>\n","protected":false},"excerpt":{"rendered":"If you are looking for a tool to dynamically embed your data lineage into your own website, SQLFlow Widget would be a good choice. The SQLFlow Widget is a Javascript library that enables instantaneous data lineage visualisation on your website. SQLFlow Widget works together with the Gudu SQLFlow backend in order to visualize the data lineage and provides an actionable diagram. The SQLFlow widget is shipped together with the SQLFlow On-Premise version. Once the SQLFlow Widget is installed on your server, you can access the SQLFlow widget with the Url: https:\/\/127.0.0.1\/widget. Currently there are no online demos available. Visualize the\u2026<\/p>\n","protected":false},"author":6,"featured_media":2674,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"yoast_head":"\nEmbed the data lineage generated by SQLFlow on your own website<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\t\n\t\n\t\n