blob: 33d732edd1f8b649f7917cefab1436dd097574db [file] [log] [blame]
(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{"./src/documents/Import-Export/ExportAPI.md":function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return s}));var n=a("../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),m=(a("../node_modules/react/index.js"),a("../node_modules/@mdx-js/react/dist/esm.js")),i=(a("./theme/styles/styled-colors.js"),a("../node_modules/react-syntax-highlighter/dist/esm/styles/hljs/dark.js")),r=a("../node_modules/react-syntax-highlighter/dist/esm/default-highlight.js"),l=["components"],p={};function s(e){var t=e.components,a=Object(n.a)(e,l);return Object(m.mdx)("wrapper",Object.assign({},p,a,{components:t,mdxType:"MDXLayout"}),Object(m.mdx)("h1",{id:"export-api"},"Export API"),Object(m.mdx)("p",null,"The general approach is:"),Object(m.mdx)("ul",null,Object(m.mdx)("li",{parentName:"ul"},"Consumer specifies the scope of data to be exported (details below)."),Object(m.mdx)("li",{parentName:"ul"},"The API if successful, will return the stream in the format specified."),Object(m.mdx)("li",{parentName:"ul"},"Error will be returned on failure of the call.")),Object(m.mdx)("p",null,"See ",Object(m.mdx)("a",{parentName:"p",href:"#/ExportHDFSAPI"},"here")," for details on exporting ",Object(m.mdx)("em",{parentName:"p"},"hdfs_path")," entities."),Object(m.mdx)("table",null,Object(m.mdx)("thead",{parentName:"table"},Object(m.mdx)("tr",{parentName:"thead"},Object(m.mdx)("th",{parentName:"tr",align:null},Object(m.mdx)("strong",{parentName:"th"},"Title")),Object(m.mdx)("th",{parentName:"tr",align:null},Object(m.mdx)("strong",{parentName:"th"},"Export API")))),Object(m.mdx)("tbody",{parentName:"table"},Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"Example")),Object(m.mdx)("td",{parentName:"tr",align:null},"See Examples sections below.")),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"URL")),Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"api/atlas/admin/export"))),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"Method")),Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"POST"))),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"URL Parameters")),Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"None"))),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"Data Parameters")),Object(m.mdx)("td",{parentName:"tr",align:null},"The class ",Object(m.mdx)("em",{parentName:"td"},"AtlasExportRequest")," is used to specify the items to export. The list of ",Object(m.mdx)("em",{parentName:"td"},"AtlasObjectId"),"(s) allows for specifying the multiple items to export in a session. The ",Object(m.mdx)("em",{parentName:"td"},"AtlasObjectId")," is a tuple of entity type, name of unique attribute, value of unique attribute. Several items can be specified. See examples below.")),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"Success Response")),Object(m.mdx)("td",{parentName:"tr",align:null},"File stream as ",Object(m.mdx)("em",{parentName:"td"},"application/zip"),".")),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"Error Response")),Object(m.mdx)("td",{parentName:"tr",align:null},"Errors that are handled within the system will be returned as ",Object(m.mdx)("em",{parentName:"td"},"AtlasBaseException"),".")),Object(m.mdx)("tr",{parentName:"tbody"},Object(m.mdx)("td",{parentName:"tr",align:null},Object(m.mdx)("em",{parentName:"td"},"Notes")),Object(m.mdx)("td",{parentName:"tr",align:null},"Consumer could choose to consume the output of the API by programmatically using ",Object(m.mdx)("em",{parentName:"td"},"java.io.ByteOutputStream")," or by manually, save the contents of the stream to a file on the disk.")))),Object(m.mdx)("p",null,Object(m.mdx)("strong",{parentName:"p"},"Method Signature")),Object(m.mdx)(r.a,{wrapLines:!0,language:"shell",style:i.a,mdxType:"SyntaxHighlighter"},'@POST\n@Path("/export")\n@Consumes("application/json;charset=UTF-8")'),Object(m.mdx)("h3",{id:"additional-options"},"Additional Options"),Object(m.mdx)("p",null,"It is possible to specify additional parameters for the ",Object(m.mdx)("em",{parentName:"p"},"Export")," operation."),Object(m.mdx)("p",null,"The current implementation has 2 options. Both are optional:"),Object(m.mdx)("ul",null,Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"matchType")," This option configures the approach used for fetching the starting entity. It has the following values:",Object(m.mdx)("ul",{parentName:"li"},Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"startsWith")," Search for an entity that is prefixed with the specified criteria."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"endsWith")," Search for an entity that is suffixed with the specified criteria."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"contains")," Search for an entity that has the specified criteria as a sub-string."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"matches")," Search for an entity that is a regular expression match with the specified criteria.")))),Object(m.mdx)("ul",null,Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"fetchType")," This option configures the approach used for fetching entities. It has the following values:",Object(m.mdx)("ul",{parentName:"li"},Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"FULL"),": This fetches all the entities that are connected directly and indirectly to the starting entity. E.g. If a starting entity specified is a table, then this option will fetch the table, database and all the other tables within the database."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"CONNECTED"),": This fetches all the entities that are connected directly to the starting entity. E.g. If a starting entity specified is a table, then this option will fetch the table and the database entity only."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"INCREMENTAL"),": See ",Object(m.mdx)("a",{parentName:"li",href:"#/IncrementalExport"},"here")," for details.")))),Object(m.mdx)("p",null,"If no ",Object(m.mdx)("em",{parentName:"p"},"matchType")," is specified, an exact match is used. Which means, that the entire string is used in the search criteria."),Object(m.mdx)("p",null,"Searching using ",Object(m.mdx)("em",{parentName:"p"},"matchType")," applies to all types of entities. It is particularly useful for matching entities of type hdfs_path (see ",Object(m.mdx)("a",{parentName:"p",href:"#/ExportHDFSAPI"},"here"),")."),Object(m.mdx)("p",null,"The ",Object(m.mdx)("em",{parentName:"p"},"fetchType")," option defaults to ",Object(m.mdx)("em",{parentName:"p"},"FULL"),"."),Object(m.mdx)("p",null,"For a complete example see the section below."),Object(m.mdx)("h3",{id:"contents-of-exported-zip-file"},"Contents of Exported ZIP File"),Object(m.mdx)("p",null,"The exported ZIP file has the following entries within it:"),Object(m.mdx)("ul",null,Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"atlas-export-result.json"),":",Object(m.mdx)("ul",{parentName:"li"},Object(m.mdx)("li",{parentName:"ul"},"Input filters: The scope of export."),Object(m.mdx)("li",{parentName:"ul"},"File format: The format chosen for the export operation."),Object(m.mdx)("li",{parentName:"ul"},"Metrics: The number of entity definitions, classifications and entities exported."))),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"atlas-typesdef.json"),": Type definitions for the entities exported."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"atlas-export-order.json"),": Order in which entities should be exported."),Object(m.mdx)("li",{parentName:"ul"},Object(m.mdx)("em",{parentName:"li"},"{guid}.json"),": Individual entities are exported with file names that correspond to their id.")),Object(m.mdx)("h3",{id:"examples"},"Examples"),Object(m.mdx)("p",null,"The ",Object(m.mdx)("em",{parentName:"p"},"AtlasExportRequest")," below shows filters that attempt to export 2 databases in cluster cl1:"),Object(m.mdx)(r.a,{wrapLines:!0,language:"json",style:i.a,mdxType:"SyntaxHighlighter"},'{\n "itemsToExport": [\n { "typeName": "hive_db", "uniqueAttributes": { "qualifiedName": "accounts@cl1" } },\n { "typeName": "hive_db", "uniqueAttributes": { "qualifiedName": "hr@cl1" } }\n ]\n}'),Object(m.mdx)("p",null,"The ",Object(m.mdx)("em",{parentName:"p"},"AtlasExportRequest")," below specifies the ",Object(m.mdx)("em",{parentName:"p"},"fetchType")," as ",Object(m.mdx)("em",{parentName:"p"},"FULL"),". The ",Object(m.mdx)("em",{parentName:"p"},"matchType")," option will fetch ",Object(m.mdx)("em",{parentName:"p"},"accounts@cl1"),"."),Object(m.mdx)(r.a,{wrapLines:!0,language:"json",style:i.a,mdxType:"SyntaxHighlighter"},'{\n "itemsToExport": [\n { "typeName": "hive_db", "uniqueAttributes": { "qualifiedName": "accounts@" } }\n ],\n "options": {\n "fetchType": "FULL",\n "matchType": "startsWith"\n }\n}'),Object(m.mdx)("p",null,"The ",Object(m.mdx)("em",{parentName:"p"},"AtlasExportRequest")," below specifies the ",Object(m.mdx)("em",{parentName:"p"},"guid")," instead of ",Object(m.mdx)("em",{parentName:"p"},"uniqueAttributes")," to fetch ",Object(m.mdx)("em",{parentName:"p"},"accounts@cl1"),"."),Object(m.mdx)(r.a,{wrapLines:!0,language:"json",style:i.a,mdxType:"SyntaxHighlighter"},'{\n "itemsToExport": [\n { "typeName": "hive_db", "guid": "846c5e9c-3ac6-40ju-8289-fb0cebm64783" }\n ],\n "options": {\n "fetchType": "FULL",\n }\n}'),Object(m.mdx)("p",null,"The ",Object(m.mdx)("em",{parentName:"p"},"AtlasExportRequest")," below specifies the ",Object(m.mdx)("em",{parentName:"p"},"fetchType")," as ",Object(m.mdx)("em",{parentName:"p"},"connected"),". The ",Object(m.mdx)("em",{parentName:"p"},"matchType")," option will fetch ",Object(m.mdx)("em",{parentName:"p"},"accountsReceivable"),", ",Object(m.mdx)("em",{parentName:"p"},"accountsPayable"),", etc. present in the database."),Object(m.mdx)(r.a,{wrapLines:!0,language:"json",style:i.a,mdxType:"SyntaxHighlighter"},'{\n "itemsToExport": [\n { "typeName": "hive_db", "uniqueAttributes": { "qualifiedName": "accounts" } }\n ],\n "options": {\n "fetchType": "CONNECTED",\n "matchType": "startsWith"\n }\n}'),Object(m.mdx)("p",null,"Below is the ",Object(m.mdx)("em",{parentName:"p"},"AtlasExportResult")," JSON for the export of the ",Object(m.mdx)("em",{parentName:"p"},"Sales")," DB present in the ",Object(m.mdx)("em",{parentName:"p"},"QuickStart"),"."),Object(m.mdx)("p",null,"The ",Object(m.mdx)("em",{parentName:"p"},"metrics")," contains the number of types and entities exported as part of the operation."),Object(m.mdx)(r.a,{wrapLines:!0,language:"json",style:i.a,mdxType:"SyntaxHighlighter"},'{\n "clientIpAddress": "10.0.2.15",\n "hostName": "10.0.2.2",\n "metrics": {\n "duration": 1415,\n "entitiesWithExtInfo": 12,\n "entity:DB_v1": 2,\n "entity:LoadProcess_v1": 2,\n "entity:Table_v1": 6,\n "entity:View_v1": 2,\n "typedef:Column_v1": 1,\n "typedef:DB_v1": 1,\n "typedef:LoadProcess_v1": 1,\n "typedef:StorageDesc_v1": 1,\n "typedef:Table_v1": 1,\n "typedef:View_v1": 1,\n "typedef:classification": 6\n },\n "operationStatus": "SUCCESS",\n "request": {\n "itemsToExport": [\n {\n "typeName": "DB_v1",\n "uniqueAttributes": {\n "name": "Sales"\n }\n }\n ],\n "options": {\n "fetchType": "full"\n }\n },\n "userName": "admin"\n}'),Object(m.mdx)("h3",{id:"curl-calls"},"CURL Calls"),Object(m.mdx)("p",null,"Below are sample CURL calls that demonstrate Export of ",Object(m.mdx)("em",{parentName:"p"},"QuickStart")," database."),Object(m.mdx)(r.a,{wrapLines:!0,language:"shell",style:i.a,mdxType:"SyntaxHighlighter"},'curl -X POST -u adminuser:password -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d \'{\n "itemsToExport": [\n { "typeName": "DB", "uniqueAttributes": { "name": "Sales" }},\n { "typeName": "DB", "uniqueAttributes": { "name": "Reporting" }},\n { "typeName": "DB", "uniqueAttributes": { "name": "Logging" }}\n ],\n "options": { "fetchType": "full" }\n }\' "http://localhost:21000/api/atlas/admin/export" > quickStartDB.zip'))}s&&s===Object(s)&&Object.isExtensible(s)&&Object.defineProperty(s,"__filemeta",{enumerable:!0,configurable:!0,value:{name:"MDXContent",filename:"src/documents/Import-Export/ExportAPI.md"}}),s.isMDXComponent=!0},"./theme/styles/styled-colors.js":function(e,t,a){"use strict";var n=a("../node_modules/react-syntax-highlighter/dist/esm/styles/hljs/dark.js");n.a.hljs.color="#37bb9b",t.a=n.a}}]);
//# sourceMappingURL=documents-import-export-export-api.b185f4c5b68d73002af0.js.map