generate_user_actions_for_assets

CatalogApi.generate_user_actions_for_assets(role_id, catalog_user_actions_request, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Generate user custom actions for catalog assets

Generates ready-to-use connection templates and instructions for a set of catalog assets, covering the SQL playground and the supported analytics tools, plus any caveats that apply to the specific assets chosen. Only AssetType “dataset” produces output. Any other value returns HTTP 200 with empty ApplicableTemplates and DatasetInstructions rather than an error, so check that ApplicableTemplates is non-empty before relying on it. The caller must hold owner, editor or read-only access on every requested asset. A single inaccessible asset fails the whole request with AUTH-1010, and an unknown or deleted asset id produces that same error rather than a distinct not-found response.

Parameters:
  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the caller belongs to. (required)

  • catalog_user_actions_request (CatalogUserActionsRequest) – (required)

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

CatalogUserActionsResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /catalog/user-actions

Parameter examples

Name

In

Example

role_id

header

"role-admin"

Request

Templates for one dataset

{
  "AssetType": "dataset",
  "AssetIds": [
    "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f"
  ]
}

Templates spanning several datasets

{
  "AssetType": "dataset",
  "AssetIds": [
    "b1e6c2a0-9f4d-4c7a-8f2e-1a2b3c4d5e6f",
    "c2f7d3b1-1a2b-4d8e-9f3a-2b3c4d5e6f70",
    "d3a8e4c2-2b3c-4e9f-8a4b-3c4d5e6f7081"
  ]
}

Success (HTTP 200)

Templates and instructions for the requested assets. Both fields are empty when AssetType is not “dataset”, or when every requested dataset is unregistered or S3-backed.

Templates generated for a queryable dataset

{
  "ApplicableTemplates": {
    "Playground": "SELECT * FROM sales.customer_orders LIMIT 10;",
    "AnalyticsTool": {
      "Tableau": "Connect Tableau to Amorphic using the Athena connector...",
      "PowerBI": "Connect Power BI to Amorphic using the Athena connector..."
    },
    "SampleQueries": "SELECT * FROM sales.customer_orders LIMIT 10;"
  },
  "DatasetInstructions": []
}

Some requested datasets are unregistered or S3-backed

{
  "ApplicableTemplates": {
    "Playground": "SELECT * FROM sales.customer_orders LIMIT 10;",
    "AnalyticsTool": {
      "Tableau": "Connect Tableau to Amorphic using the Athena connector...",
      "PowerBI": "Connect Power BI to Amorphic using the Athena connector..."
    },
    "SampleQueries": "SELECT * FROM sales.customer_orders LIMIT 10;"
  },
  "DatasetInstructions": [
    {
      "UnregisteredDataset": {
        "DatasetIds": [
          {
            "DatasetId": "c2f7d3b1-1a2b-4d8e-9f3a-2b3c4d5e6f70",
            "DatasetName": "pending_dataset"
          }
        ],
        "Instructions": "This dataset is not yet registered. Complete registration before querying it."
      }
    },
    {
      "S3Dataset": {
        "DatasetIds": [
          {
            "DatasetId": "d3a8e4c2-2b3c-4e9f-8a4b-3c4d5e6f7081",
            "DatasetName": "raw_files"
          }
        ],
        "Instructions": "This dataset is stored on S3 and is not queryable through the SQL playground."
      }
    }
  ]
}

AssetType other than dataset returns empty results, not an error

{
  "ApplicableTemplates": {},
  "DatasetInstructions": []
}

Errors

Documented error codes: IPV-1080, AUTH-1010, AUTH-1001.

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1080 (more than 10 asset IDs), AUTH-1010 (the caller lacks access to at least one requested asset, which also covers unknown or deleted asset IDs), AUTH-1001 (role_id header missing).

More than 10 asset IDs supplied

{
  "Message": "IPV-1080 - Maximum of 10 assets are allowed per request"
}

Caller lacks access to a requested asset, or the asset does not exist

{
  "Message": "AUTH-1010 - User is not authorized to perform this operation"
}

HTTP 500

Something went wrong at backend