Skip to content

Get all assets that are deprecated

1.4.0 1.1.0

This example finds all assets that are marked as deprecated.

Get all deprecated assets
1
2
3
4
5
6
7
AtlanClient client = Atlan.getDefaultClient(); // (1)
client.assets.select() // (2)
    .where(Asset.CERTIFICATE_STATUS.eq(CertificateStatus.DEPRECATED)) // (3)
    .stream() // (4)
    .forEach(a -> { // (5)
        log.info("Asset: {}", a);
    });
  1. Start with a client to run the search through. For the default client, you can always use Atlan.getDefaultClient().
  2. To search across all assets, you can use the assets.select() convenience method on a client.
  3. The .where() method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so use Asset.CERTIFICATE_STATUS.

    Since we only want assets that are deprecated, we will query where that certificate is set to the CertificateStatus.DEPRECATED value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.)

  4. The search will only run when you call the stream() method, which will then lazily-load each page of results into a stream.

  5. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Get all deprecated assets
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Asset
from pyatlan.model.enums import CertificateStatus
from pyatlan.model.fluent_search import FluentSearch

client = AtlanClient()  # (1)
request = (
    FluentSearch()  # (2)
    .where(Asset.CERTIFICATE_STATUS.eq(CertificateStatus.DEPRECATED.value))  # (3)
).to_request()  # (4)
for result in client.asset.search(request):  # (5)
    print(result)
  1. Start with a client to run the search through. For the default client, you can always use AtlanClient().
  2. To search across all assets, you can use a FluentSearch object.
  3. The .where() method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so use Asset.CERTIFICATE_STATUS.

    Since we only want assets that are deprecated, we will query where that certificate is set to the CertificateStatus.DEPRECATED value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.)

  4. You can then translate the fluent search into an index search request.

  5. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Get all deprecated assets
1
2
3
4
5
6
7
val client = Atlan.getDefaultClient() // (1)
client.assets.select() // (2)
    .where(Asset.CERTIFICATE_STATUS.eq(CertificateStatus.DEPRECATED)) // (3)
    .stream() // (4)
    .forEach { // (5)
        log.info { "Asset: $it" }
    }
  1. Start with a client to run the search through. For the default client, you can always use Atlan.getDefaultClient().
  2. To search across all assets, you can use the assets.select() convenience method on a client.
  3. The .where() method allows you to limit to only assets that have a particular value in a particular field. In this example, we are looking for values for the certificate status, so use Asset.CERTIFICATE_STATUS.

    Since we only want assets that are deprecated, we will query where that certificate is set to the CertificateStatus.DEPRECATED value. (No need to try to remember or ever even know what the precise string values for the certificates are — we've provided enums for them in the SDK.)

  4. The search will only run when you call the stream() method, which will then lazily-load each page of results into a stream.

  5. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.

Requires multiple API operations

Before you can search for classifications, you first need to have the Atlan-internal hashed-string representation of the classification. You will likely need to first retrieve the hashed-string representation.

POST /api/meta/search/indexsearch
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "dsl": { // (1)
    "query": { // (2)
      "term": { // (3)
        "certificateStatus": { // (4)
          "value": "DEPRECATED" // (5)
        }
      }
    },
    "track_total_hits": true
  },
  "suppressLogs": true,
  "showSearchScore": false,
  "excludeMeanings": false,
  "excludeClassifications": false
}
  1. Run a search to find the assets.
  2. For a search with only a single condition, we can directly provide the condition.
  3. You can use the term query to exactly match a value on assets, for a given field.
  4. Use the name of the field you want to match. In this example, since you want to match a specific certificate, you can use the certificateStatus field.
  5. Provide the exact value you want to match in that field. In this example, you will be matching only assets with a certificate of DEPRECATED.