Created 03-13-2017 06:49 PM
I'd like to define and create a new meta model in Atlas.
I would like it to store a date and a value, but also inherit values from existing types: hive tables and dbs.
I can create new simple types and entities, but I'm having problems getting the right behaviour for the hive tables and dbs.
I when I create a simple type with 'superTypes' of Asset and Referenceable I'm able to create simple entities. But when I use DataSet I get errors.
Here's a type I tried (I get get values and dates to work so this is just trying to get the hive_db attribute to work):
{ "enumTypes": [], "structTypes": [], "traitTypes": [], "classTypes": [ { "superTypes": [ "DataSet" ], "hierarchicalMetaTypeName": "org.apache.atlas.typesystem.types.ClassType", "typeName": "test_type_class_22", "typeDescription": null, "attributeDefinitions": [ { "dataTypeName": "hive_db", "isComposite": false, "isIndexable": true, "isUnique": false, "multiplicity": "required", "name": "db", "reverseAttributeName": null } ] } ] }
But I don't know how to properly create values that point to the actual 'default' database.
{ "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Reference", "id":{ "jsonClass":"org.apache.atlas.typesystem.json.InstanceSerialization$_Id", "id":"-1566683608564093000", "version":0, "typeName":"test_type_class_22", "state":"ACTIVE" }, "typeName":"test_type_class_22", "values":{ "name":"default" "qualifiedName":"default@Sandbox", "description":"test description", "owner":null, "db": "default" }, "traitNames":[ ], "traits":{ } }
For the value of 'db' (which is of datatype hive_db) I tried "default", "default@Sandbox", "default.test_type_class_22@sandbox" and "da862503-62f0-41a6-8acc-da4efcf856eb". I just don't know what I should be setting this to. Any ideas? All return the error similar to:
{ "error": "Unable to deserialize json", "stackTrace": "java.lang.IllegalArgumentException: Unable to deserialize json at org.apache.atlas.services.DefaultMetadataService.deserializeClassInstances(DefaultMetadataService.java:350) at org.apache.atlas.services.DefaultMetadataService.createEntities(DefaultMetadataService.java:323) at org.apache.atlas.web.resources.EntityResource.submit(EntityResource.java:133) at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:287) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:277) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:182) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) at org.apache.atlas.web.filters.AuditFilter.doFilter(AuditFilter.java:71) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:119) at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:133) at com.google.inject.servlet.GuiceFilter$1.call(GuiceFilter.java:130) at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:130) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.apache.atlas.web.filters.AtlasAuthorizationFilter.doFilter(AtlasAuthorizationFilter.java:154) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.apache.atlas.web.filters.AtlasCSRFPreventionFilter$ServletFilterHttpInteraction.proceed(AtlasCSRFPreventionFilter.java:232) at org.apache.atlas.web.filters.AtlasCSRFPreventionFilter.handleHttpInteraction(AtlasCSRFPreventionFilter.java:177) at org.apache.atlas.web.filters.AtlasCSRFPreventionFilter.doFilter(AtlasCSRFPreventionFilter.java:187) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.apache.atlas.web.filters.AtlasAuthenticationFilter.doFilter(AtlasAuthenticationFilter.java:301) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.atlas.typesystem.IReferenceableInstance at org.apache.atlas.typesystem.types.ClassType.convert(ClassType.java:138) at org.apache.atlas.services.DefaultMetadataService.getTypedReferenceableInstance(DefaultMetadataService.java:365) at org.apache.atlas.services.DefaultMetadataService.deserializeClassInstances(DefaultMetadataService.java:342) ... 85 more " }
Created 03-13-2017 09:19 PM
@Laura Ngo if you need to create an entity with attribute of type class - you need to mention it in Id format.
hive_db must be referenced through Id, as shown in the sample below.
POST http://localhost:21000/api/atlas/entities
{ "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference", "id": { "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id", "id": "-1566683608564093000", "version": 0, "typeName": "test_type_class_22", "state": "ACTIVE" }, "typeName": "test_type_class_22", "values": { "name": "default", "qualifiedName": "default@Sandbox", "description": "test description", "owner": null, "db": { "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id", "id": "da862503-62f0-41a6-8acc-da4efcf856eb", "version": 0, "typeName": "hive_db", "state": "ACTIVE" } }, "traitNames": [], "traits": {} }
Created 03-13-2017 09:19 PM
@Laura Ngo if you need to create an entity with attribute of type class - you need to mention it in Id format.
hive_db must be referenced through Id, as shown in the sample below.
POST http://localhost:21000/api/atlas/entities
{ "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Reference", "id": { "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id", "id": "-1566683608564093000", "version": 0, "typeName": "test_type_class_22", "state": "ACTIVE" }, "typeName": "test_type_class_22", "values": { "name": "default", "qualifiedName": "default@Sandbox", "description": "test description", "owner": null, "db": { "jsonClass": "org.apache.atlas.typesystem.json.InstanceSerialization$_Id", "id": "da862503-62f0-41a6-8acc-da4efcf856eb", "version": 0, "typeName": "hive_db", "state": "ACTIVE" } }, "traitNames": [], "traits": {} }
Created 03-13-2017 10:26 PM
Would recommend using the V2 apis for easy integration and interfacing with Atlas.
Created 03-14-2017 12:42 AM
Does V2 ship with 0.8? What hdp release is that likely to be in? 2.6 or 3?
Created 03-14-2017 07:58 AM
Yes, Atlas 0.8 will have all the new v2 APIs for types, entities, lineage and discovery. The corresponding HDP release will be 2.6
Created 03-13-2017 10:27 PM
I think this might prove useful for understanding the APIs and the integration