top of page

Coffee and Tips Newsletter

Assine nossa newsletter para receber tutoriais Tech, reviews de dispositivos e notícias do mundo Tech no seu email

Nos vemos em breve!

Writer's pictureJP

Listing AWS Glue tables


AWS Glue


Using an AWS SDK is always a good option if you need to explore some feature further in search of a solution. In this post, we're going to explore some of AWS Glue using SDK and Java.


Glue is an AWS ETL tool that provides a central repository of metadata, called Glue Catalog.


In short, the Glue Catalog keeps the entire structure of databases and tables and their schemas in a single place. The idea of ​​this post will be to programmatically list all the tables of a given database in the Glue Catalog using the SDK and Java.


Maven dependencies


In this example, we're using the Java 8 version to better explore the use of Streams in the interaction.


Undestanding


  • awsGlue object is responsible for accessing the resource through the credentials that must be configured. In this post we will not go into this detail.


  • The getTablesRequest object is responsible for setting the request parameters, in this case, we're setting the database.


  • getTablesResult object is responsible for listing the tables based on the parameters set by the getTablesRequest object and also for controlling the result flow. Note that in addition to returning the tables through the getTablesResult.getTableList() method, this same object returns a token that will be explained further in the next item.


  • The token is represented by the getTablesResult.getNextToken() method, the idea of ​​the token is to control the flow of results, as all results are paged and if there is a token for each result, it means that there is still data to be returned. In the code, we used a repetition structure based on validating the existence of the token. So, if there is still a token, it will be set in the getTableRequest object through the code getTableRequest.setNextToken(token), to return more results. It's a way to paginate results.

 

Books to study and read


If you want to learn more about and reach a high level of knowledge, I strongly recommend reading the following book(s):


AWS Cookbook is a practical guide containing 70 familiar recipes about AWS resources and how to solve different challenges. It's a well-written, easy-to-understand book covering key AWS services through practical examples. AWS or Amazon Web Services is the most widely used cloud service in the world today, if you want to understand more about the subject to be well positioned in the market, I strongly recommend the study.









 

Setup recommendations


If you have interesting to know what's my setup I've used to develop my tutorials, following:

















Well that’s it, I hope you enjoyed it!


Comments


bottom of page