The DataMeshConsumer.py class provides functions to manage Consumer functions such as requesting access to data products and finalizing subscriptions.
DataMeshConsumer(
data_mesh_account_id: str,
region_name: str = 'us-east-1',
log_level: str = "INFO",
use_credentials=None
) data_mesh_account_id: The AWS Account ID to use as the central Data Mesh Account in the regionregion_name: The short AWS Region Name in which to install the Data Meshlog_level: The level of information you want to see when executing. Based upon pythonlogging, values includeINFO,DEBUG,ERROR, etc.use_credentials: Credentials to use to setup the instance. This can be provided as a boto3 Credentials object, a dict containing the below structure, or if None is provided the boto3 environment will be accessed.
{
"AccountId": "The Consumer AWS Account ID",
"AccessKeyId": "Your access key",
"SecretAccessKey": "Your secret key",
"SessionToken": "Optional - a session token, if you are using an IAM Role & temporary credentials"
}The following methods are available:
delete_subscriptionfinalize_subscriptionget_subscriptionget_table_infolist_product_accessrequest_access_to_product
Method allowing a Consumer to leave a subscription.
delete_subscription(
subscription_id: str,
reason: str
)subscription_id: The ID of the Subscription to leavereason: String value to be added to the Subscription about why it's being deleted
None
Performs the final step in the Subscription workflow to import the shared objects.
finalize_subscription(
subscription_id: str
)subscription_id: The ID of the Subscription to complete
None
Fetches information about a given Subscription request.
get_subscription(
request_id: str
)request_id: The ID of the Subscription request to fetch
dict
{
'Subscriptions': [
{
"SubscriptionId": str,
"Status": str,
"DatabaseName": str,
"TableName": list<string>,
"RequestedGrants": list<string>,
"PermittedGrants": list<string>,
"SubscriberPrincipal": str,
"CreationDate": str,
"CreatedBy": str,
"UpdatedDate": str,
"UpdatedBy": str,
"Notes": list,
"RamShares": list<string>,
"GrantedTableARNs": list<string>
}
]
}
- (dict)
Subscriptions: List of pending subscriptionsSubscriptionId: The ID assigned to the Subscription requestDatabaseName: The name of the database containing shared objectsTableName: List of table names being requestedRequestedGrants: Grants requested by the ConsumerPermittedGrants: Grants which have been approved by the Producer *GrantableGrants: Grants the Consumer can shareOwnerPrincipal: The AWS Account ID of the OwnerSubscriberPrincipal: The AWS Account ID of the requesting ConsumerCreationDate: Date the request was made, inYYYY-MM-DD HH:MI:SSformatCreatedBy: The Identity of the Principal who requested accessUpdatedDate: The date of the last update, inYYYY-MM-DD HH:MI:SSformatUpdatedBy: The Identity of the Principal who made the last update
Consumer wrapper interface for Glue::GetTable (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glue.html#Glue.Client.get_table).
get_table_info(
database_name: str,
table_name: str
)database_name: The name of the Glue Catalog Database where the Table is storedtable_name: The name of the table to describe
dict
Lists the data products to which the consumer has access.
list_product_access()None
list
[
{
'Subscriptions': [
{
"SubscriptionId": str,
"DatabaseName": str,
"TableName": list<string>,
"RequestedGrants": list<string>,
"SubscriberPrincipal": str,
"CreationDate": str,
"CreatedBy": str
},
...
]
}
...
]
- (list)
- (dict)
SubscriptionId: The ID assigned to the Subscription requestDatabaseName: The name of the database containing shared objectsTableName: List of table names being requestedRequestedGrants: Grants requested by the ConsumerPermittedGrants: Grants which have been approved by the ProducerGrantableGrants: Grants the Consumer can shareOwnerPrincipal: The AWS Account ID of the OwnerSubscriberPrincipal: The AWS Account ID of the requesting ConsumerCreationDate: Date the request was made, inYYYY-MM-DD HH:MI:SSformatCreatedBy: The Identity of the Principal who requested accessUpdatedDate: The date of the last update, inYYYY-MM-DD HH:MI:SSformatUpdatedBy: The Identity of the Principal who made the last update
- (dict)
Requests a set of grants to a shared data product from the Producer.
request_access_to_product(
owner_account_id: str,
database_name: str,
request_permissions: list,
tables: list = None)owner_account_id: The AWS Account who owns the objects for which the Consumer is requesting accessdatabase_name: The database name of the shared objectsrequest_permission: The list of permissions to be requested, such asSELECTorINSERTtables: Optional list of tables or a regular expression definiting tables to request access to
dict
{
"Type": str,
"Database":str,
"Table":str
}Type: The type of access request created - one of DATABASE or TABLEDatabase: The name of the database for which a subscription has been createdTable: Optional name of a table for which the subscription has been created