Beispiel #1
0
        private Dictionary <string, string> getClassifiedColumns(string tableguid)
        {
            // find columns in this table by guid
            var client = getDCClient();
            JsonAtlasEntityWithExtInfo dbinfo = client.EntityREST.GetById(tableguid);

            // only get columns with classififcations attached to them
            Dictionary <string, string> classifiedcolumns = new Dictionary <string, string>();

            foreach (var column in dbinfo.ReferredEntities.Values)
            {
                if (column.Classifications != null && column.Classifications.Count > 0)
                {
                    // name
                    object qName;
                    column.Attributes.TryGetValue("qualifiedName", out qName);
                    // classifications
                    string classifications = column.Classifications[0].TypeName; // TODO: iterate over all
                    classifiedcolumns.Add(qName as string, classifications);
                }
            }
            _Logger.LogDebug("Found classified columns {0} in table {1}", classifiedcolumns.Count, tableguid);
            return(classifiedcolumns);
        }
 /// <summary>
 /// Updates entity partially - Allows a subset of attributes to be updated on
 /// an entity which is identified by its type and unique attribute  eg:
 /// Referenceable.qualifiedName.
 /// Null updates are not possible.
 /// In addition to the typeName path parameter, attribute key-value pair(s) can
 /// be provided in the following format:
 /// attr:&lt;attrName&gt;=&lt;attrValue&gt;.
 /// NOTE: The attrName and attrValue should be unique across entities, eg.
 /// qualifiedName.
 /// The REST request would look something like this:
 /// PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='typeName'>
 /// The name of the type.
 /// </param>
 /// <param name='atlasEntityWithExtInfo'>
 /// Atlas entity with extended information.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <JsonEntityMutationResponse> PartialUpdateEntityByUniqueAttrsAsync(this IEntityREST operations, string typeName, JsonAtlasEntityWithExtInfo atlasEntityWithExtInfo, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PartialUpdateEntityByUniqueAttrsWithHttpMessagesAsync(typeName, atlasEntityWithExtInfo, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Updates entity partially - Allows a subset of attributes to be updated on
 /// an entity which is identified by its type and unique attribute  eg:
 /// Referenceable.qualifiedName.
 /// Null updates are not possible.
 /// In addition to the typeName path parameter, attribute key-value pair(s) can
 /// be provided in the following format:
 /// attr:&lt;attrName&gt;=&lt;attrValue&gt;.
 /// NOTE: The attrName and attrValue should be unique across entities, eg.
 /// qualifiedName.
 /// The REST request would look something like this:
 /// PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='typeName'>
 /// The name of the type.
 /// </param>
 /// <param name='atlasEntityWithExtInfo'>
 /// Atlas entity with extended information.
 /// </param>
 public static JsonEntityMutationResponse PartialUpdateEntityByUniqueAttrs(this IEntityREST operations, string typeName, JsonAtlasEntityWithExtInfo atlasEntityWithExtInfo)
 {
     return(operations.PartialUpdateEntityByUniqueAttrsAsync(typeName, atlasEntityWithExtInfo).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Creates or updates an entity in Atlas.
 /// Existing entity is matched using its unique guid if supplied or by its
 /// unique attributes eg: qualifiedName.
 /// Map and array of collections are not well supported. E.g.,
 /// array&lt;array&lt;int&gt;&gt;, array&lt;map&lt;string, int&gt;&gt;.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='entity'>
 /// Atlas entity with extended information.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <JsonEntityMutationResponse> CreateOrUpdateAsync(this IEntityREST operations, JsonAtlasEntityWithExtInfo entity, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(entity, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Creates or updates an entity in Atlas.
 /// Existing entity is matched using its unique guid if supplied or by its
 /// unique attributes eg: qualifiedName.
 /// Map and array of collections are not well supported. E.g.,
 /// array&lt;array&lt;int&gt;&gt;, array&lt;map&lt;string, int&gt;&gt;.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='entity'>
 /// Atlas entity with extended information.
 /// </param>
 public static JsonEntityMutationResponse CreateOrUpdate(this IEntityREST operations, JsonAtlasEntityWithExtInfo entity)
 {
     return(operations.CreateOrUpdateAsync(entity).GetAwaiter().GetResult());
 }