Remove Tags from AWS Glue Resources using Boto3

Ashish Anand
Updated on 15-Apr-2021 13:07:18

305 Views

In this article, we will see how to remove tags from AWS Glue Resources.ExampleRemove tags “glue-db: tests” in AWS glue database. Problem Statement: Use boto3 library in Python to remove tags in AWS Glue Resources.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: resource_arn and tags_list are the required parameters in this function.The format of resource_arn should be as following −Catalogarn:aws:glue:region:account-id:catalogDatabasearn:aws:glue:region:account-id:database/database nameTablearn:aws:glue:region:account-id:table/database name/table nameConnectionarn:aws:glue:region:account-id:connection/connection nameCrawlerarn:aws:glue:region:account-id:crawler/crawler-nameJobarn:aws:glue:region:account-id:job/job-nameTriggerarn:aws:glue:region:account-id:trigger/trigger-nameDevelopment endpointarn:aws:glue:region:account-id:devEndpoint/development-endpoint-nameMachine learning transformarn:aws:glue:region:account-id:mlTransform/transform-idtags_list should be as [“key1, key2…]Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, ... Read More

Get Tags from AWS Glue Resources Using Boto3

Ashish Anand
Updated on 15-Apr-2021 13:06:58

1K+ Views

In this article, we will see how the users can get the tags associated in AWS Glue Resources.ExampleGet tags “glue-db: tests” from AWS glue database. Problem Statement: Use boto3 library in Python to get the tags from AWS Glue Resources.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: resource_arn is the required parameter in this function.Format of resource_arn should be as following −Catalogarn:aws:glue:region:account-id:catalogDatabasearn:aws:glue:region:account-id:database/database nameTablearn:aws:glue:region:account-id:table/database name/table nameConnectionarn:aws:glue:region:account-id:connection/connection nameCrawlerarn:aws:glue:region:account-id:crawler/crawler-nameJobarn:aws:glue:region:account-id:job/job-nameTriggerarn:aws:glue:region:account-id:trigger/trigger-nameDevelopment endpointarn:aws:glue:region:account-id:devEndpoint/development-endpoint-nameMachine learning transformarn:aws:glue:region:account-id:mlTransform/transform-idStep 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, then explicitly pass ... Read More

Add Tags in AWS Glue Resources using Boto3

Ashish Anand
Updated on 15-Apr-2021 13:06:39

1K+ Views

In this article, we will see how a user can add tags in AWS Glue Resources.ExampleAdd tags “glue-db: tests” in AWS glue database. Problem Statement: Use boto3 library in Python to add tags in AWS Glue Resources.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: resource_arn and tags_dict are the required parameters in this function.The format of resource_arn should be as following −Catalogarn:aws:glue:region:account-id:catalogDatabasearn:aws:glue:region:account-id:database/database nameTablearn:aws:glue:region:account-id:table/database name/table nameConnectionarn:aws:glue:region:account-id:connection/connection nameCrawlerarn:aws:glue:region:account-id:crawler/crawler-nameJobarn:aws:glue:region:account-id:job/job-nameTriggerarn:aws:glue:region:account-id:trigger/trigger-nameDevelopment endpointarn:aws:glue:region:account-id:devEndpoint/development-endpoint-nameMachine learning transformarn:aws:glue:region:account-id:mlTransform/transform-idtags_dict should be as {“key”:”value”, ..}Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is ... Read More

Add Advanced Features to a Tkinter Text Widget

Dev Prakash Sharma
Updated on 15-Apr-2021 13:06:12

697 Views

Tkinter text widget is much more than just a multiline text editor. It is useful for many applications where user interaction is required.In order to configure the text widget, tkinter provides many functions and methods. Some of the features that we can add to style the text widgets are: changing the font-family, background-color, foreground-color, adding and selecting a particular text, changing font-size, and many more.ExampleIn this example, we will see how we can add different features to a particular text widget, #Import tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set ... Read More

Find Difference Between Current Time and Given Time in Python

AmitDiwan
Updated on 15-Apr-2021 13:06:06

396 Views

When it is required to find the difference between the current time and a given time, a method can be defined, that takes the hours, minutes, and seconds as parameter. It then calculates the difference between two given times.Below is a demonstration of the same −Example Live Demodef difference_time(h_1, m_1, h_2, m_2):    t_1 = h_1 * 60 + m_1    t_2 = h_2 * 60 + m_2    if (t_1 == t_2):       print("The times are the same")       return    else:       diff = t_2-t_1    hours = (int(diff / ... Read More

Find Yesterday's, Today's, and Tomorrow's Date in Python

AmitDiwan
Updated on 15-Apr-2021 13:05:43

463 Views

When it is required to find yesterday, today and tomorrow’s date with respect to current date, the current time is determined, and a method is used (in built) that helps find previous day and next day’s dates.Below is a demonstration of the same −Example Live Demofrom datetime import datetime, timedelta present = datetime.now() yesterday = present - timedelta(1) tomorrow = present + timedelta(1) print("Yesterday was :") print(yesterday.strftime('%d-%m-%Y')) print("Today is :") print(present.strftime('%d-%m-%Y')) print("Tomorrow would be :") print(tomorrow.strftime('%d-%m-%Y'))OutputYesterday was : 05-04-2021 Today is : 06-04-2021 Tomorrow would be : 07-04-2021ExplanationThe required packages are imported into the environment.The current date is determined ... Read More

Python Program to Print the Pattern G

AmitDiwan
Updated on 15-Apr-2021 13:05:23

570 Views

When it is required to print the pattern of the letter ‘G’ using ‘*’, a method can be defined, and nested loop can be used to iterate through the numbers and print ‘*” to form a ‘G’ pattern.Below is a demonstration of the same −Exampledef display_pattern(my_line):    my_pattern=""    for i in range(0, my_line):       for j in range(0, my_line):          if ((j == 1 and I != 0 and I != my_line-1) or ((I == 0 or I == my_line-1) and j > 1 and j < my_line-2) or (I == ((my_line-1)/2) and j ... Read More

Display Fibonacci Sequence Using Recursion in Python

AmitDiwan
Updated on 15-Apr-2021 13:04:56

384 Views

When it is required to print the fibonacci sequence using the method of recursion, a method can be declared that calls the same method again and again until a base value is reached.Below is a demonstration of the same −Example Live Demodef fibonacci_recursion(my_val):    if my_val

Stop a Crawler in AWS Glue Data Catalog Using Boto3

Ashish Anand
Updated on 15-Apr-2021 13:02:17

245 Views

In this article, we will see how a user can stop a crawler present in an AWS Glue Data Catalog.ExampleProblem Statement: Use boto3 library in Python to stop a crawler.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: crawler_name is the parameter in this function.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.Step 4: Create an AWS client for glue.Step 5: Now use the stop_crawler function and pass the parameter crawler_name ... Read More

Stop a Workflow in AWS Glue Data Catalog Using Boto3

Ashish Anand
Updated on 15-Apr-2021 13:01:57

520 Views

In this article, we will see how a user can stop a workflow present in an AWS account.ExampleProblem Statement: Use boto3 library in Python to stop a workflow.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: workflow_name and run_id are the required parameters in this function.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in the default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.Step 4: Create an AWS client for glue.Step 5: Now use the stop_workflow_run function and pass the parameter ... Read More

Advertisements