Created
September 2, 2023 13:46
-
-
Save brunoluz/1692d1fc4dd8c8c573754e090a94a7c4 to your computer and use it in GitHub Desktop.
Obter data de criação de uma tabela glue via Boto3 e glue client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
# Configure a sessão AWS (substitua com suas próprias credenciais e região) | |
session = boto3.Session( | |
aws_access_key_id='[aws access key]', | |
aws_secret_access_key='[aws secret key]', | |
region_name='[aws region]' | |
) | |
# Crie um cliente Glue | |
glue_client = session.client('glue') | |
# Nome do banco de dados e tabela que você deseja consultar | |
database_name = 'db_teste' | |
table_name = 'tb_teste' | |
# Consulte a tabela no Glue Catalog | |
response = glue_client.get_table(DatabaseName=database_name, Name=table_name) | |
# Obtenha a data de criação da tabela | |
creation_time = response['Table']['CreateTime'] | |
print(f"creation time: {creation_time}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment