Found 26504 Articles for Server Side Programming

How to use Boto3 to reset the bookmark of job in AWS account

Ashish Anand
Updated on 15-Apr-2021 12:54:11

638 Views

In this article, we will see how a user can reset the bookmark of a job present in ann AWS account.ExampleReset the bookmark of a job available in an AWS Glue Data Catalog.Problem Statement: Use boto3 library in Python to reset the bookmark of a job.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: job_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 ... Read More

How to use Boto3 to get the list of workflows present an in AWS account

Ashish Anand
Updated on 15-Apr-2021 12:53:51

243 Views

In this article, we will see how a user can get the list of all workflows present in an AWS account.ExampleGet the list of all workflows available in an AWS Glue Data Catalog.Problem Statement: Use boto3 library in Python to get the list of all workflows.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: There are no parameters in this function.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.Step 4: Create an ... Read More

Python program to unique keys count for Value in Tuple List

AmitDiwan
Updated on 15-Apr-2021 12:58:40

164 Views

When it is required to get the count of unique keys for values in a list of tuple, it can be iterated over and the respective counts can be determined.Below is a demonstration of the same −Example Live Demoimport collections my_result = collections.defaultdict(int) my_list = [[('Hello', 'Hey')], [('Jane', 'Will')], [('William', 'John')], [('Hello', 'Hey')], [('z', 'q')]] print("The list of list is :") print(my_list) for elem in my_list:    my_result[elem[0]] += 1 print("The result is : ") print(my_result)OutputThe list of list is : [[('Hello', 'Hey')], [('Jane', 'Will')], [('William', 'John')], [('Hello', 'Hey')], [('z', 'q')]] The result is : defaultdict(, {('Hello', 'Hey'): 2, ('Jane', ... Read More

Python program to count Bidirectional Tuple Pairs

AmitDiwan
Updated on 15-Apr-2021 12:58:16

189 Views

When it is required to count the number of bidirectional tuple pairs in a list of tuples, the list can be iterated over using nested loops, and the ‘AND’ operation is performed on the first element and result of equality between first and second element.Below is a demonstration of the same −Example Live Demomy_list = [(45, 67), (11, 23), (67, 45), (23, 11), (0, 9), (67, 45)] print("The list is : ") print(my_list) my_result = 0 for idx in range(0, len(my_list)):    for iidx in range(idx + 1, len(my_list)):       if my_list[iidx][0] == my_list[idx][1] and my_list[idx][1] == ... Read More

Python Program to Find the Sum of all Nodes in a Tree

AmitDiwan
Updated on 15-Apr-2021 12:57:57

412 Views

When it is required to get the sum of all the nodes in a Tree, a ‘Tree_structure’ class is created, methods to set a root value, and to add other values are defined. It also has a method to determine the sum of all elements of a Tree structure. Various options are given that the user can select. Based on the user’s choice, the operation is performed on the Tree elements.Below is a demonstration of the same −Example Live Democlass Tree_structure:    def __init__(self, data=None):       self.key = data       self.children = []    def set_root(self, ... Read More

Python Program to Count Number of Non Leaf Nodes of a given Tree

AmitDiwan
Updated on 15-Apr-2021 12:53:32

219 Views

When it is required to find the count of the non leaf nodes in a Tree, a ‘Tree_structure’ class is created, methods to set a root value, and to add other values are defined. Various options are given that the user can select. Based on the user’s choice, the operation is performed on the Tree elements.Below is a demonstration of the same −Example Live Democlass Tree_structure:    def __init__(self, data=None):       self.key = data       self.children = []    def set_root(self, data):       self.key = data    def add_vals(self, node):       ... Read More

Python Program to Count Number of Leaf Node in a Tree

AmitDiwan
Updated on 15-Apr-2021 12:53:11

626 Views

When it is required to count the number of leaf nodes in a Tree, a ‘Tree_structure’ class is created, methods to add root value, and other children values are defined. Various options are given that the user can select. Based on the user’s choice, the operation is performed on the Tree elements.Below is a demonstration of the same −Example Live Democlass Tree_structure:    def __init__(self, data=None):       self.key = data       self.children = []    def set_root_node(self, data):       self.key = data    def add_vals(self, node):       self.children.append(node)    def ... Read More

How to use Boto3 to get the list of triggers present in an AWS account

Ashish Anand
Updated on 15-Apr-2021 12:50:22

456 Views

In this article, we will see how a user can get the list of all triggers present in an AWS account.ExampleGet the list of all triggers available in an AWS Glue Data Catalog.Problem Statement: Use boto3 library in Python to get the list of all triggers.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: There are no parameters in this function.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.Step 4: Create an ... Read More

How to use Boto3 to get the list of schemas present in AWS account

Ashish Anand
Updated on 15-Apr-2021 12:50:01

373 Views

In this article, we will see how a user can get the list of all schemas present in an AWS account.ExampleGet the list of all the schemas available in an AWS Glue Data Catalog.Problem Statement: Use boto3 library in Python to get the list of all schemas.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: There are no parameters in this function.Step 3: Create an AWS session using boto3 lib. Make sure region_name is mentioned in default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.Step 4: Create ... Read More

How to get the list of all registries present in an AWS account using Boto3

Ashish Anand
Updated on 15-Apr-2021 12:49:42

146 Views

In this article, we will see how a user can get the list of all registries present in an AWS account.ExampleGet the list of all registries available in AWS Glue Data Catalog.Problem Statement: Use boto3 library in Python to get the list of all registries.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: There are no 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 ... Read More

Advertisements