'Extract connections in airflow and use in boto3

I am. trying to extract connections from airflow as

key,pass = BaseHook.get_connection('aws_default') 
print(conn.get_extra())

and use it in my boto3 connection as:

account_id = boto3.client('sts',aws_access_key_id=key,
aws_secret_access_key=pass).get_caller_identity().get('Account').

I am getting this error, how to resolve this?

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: connection


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source