boto3
boto3 copied to clipboard
AWS Lakeformation search_tables_by_lf_tags doesn't follow the behavior of the AWS CLI
Describe the bug
I'm trying to retrieve all the tables that contains a specific set of lf-tags. I first tried to use boto3 in an ETL job with that kind of request:
It returns me a empty TableList as a result.
{'ResponseMetadata': {'RequestId': 'XXXXXXXX', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Mon, 19 Sep 2022 14:07:11 GMT', 'content-type': 'application/json', 'content-length': '143', 'connection': 'keep-alive', 'x-amzn-requestid': 'XXXXXXXXX', 'cache-control': 'no-cache'}, 'RetryAttempts': 0}, 'NextToken': 'XXXXXXXX', 'TableList': []}
I suspected a bug so i put the same command with the AWS CLI:
aws lakeformation search-tables-by-lf-tags --catalog-id XXXXXXXXXXXX--expression TagKey=security,TagValues=[sensitive] --output json --region eu-west-1 --profile XXXXXXXX
Results :
... "LFTagsOnColumns": [
"Name": "XXXX",
"LFTags": [{
"CatalogId": "XXXXXXXXXXXX",
"TagKey": "security",
"TagValues": [ "sensitive" ]
}]
]....
Expected Behavior
The function search-tables-by-lf-tags in boto3 library allows to find lf-tags that are in columns of Glue Data Catalog Tables
Current Behavior
The function search-tables-by-lf-tags in boto3 library doesn't return a table with a specific set of f-tags on a column.
Reproduction Steps
- Create a Glue Data Catalog Table with lf-tags on columns.
- Allow an IAM Role to crawl on this table and grant the permission of th lf-tag to the IAM Role
- Create a Glue Job Script in which you search for the lf-tag given before
SDK version used
1.24.75
Environment details (OS name and version, etc.)
Windows 11, Test on Python Console and terminal inside a venv
Hi @yanniouamara thanks for reaching out. Can you please share your debug logs (with any sensitive info redacted) by adding boto3.set_stream_logger('')
to your script? That could help give us more insight into the behavior here.
Thank you for your reactivity, here are the logs :
| WARNING: The directory '/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag. |
| ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. awscli 1.23.5 requires botocore==1.25.5, but you have botocore 1.27.77 which is incompatible. awscli 1.23.5 requires s3transfer<0.6.0,>=0.5.0, but you have s3transfer 0.6.0 which is incompatible. aiobotocore 2.2.0 requires botocore<1.24.22,>=1.24.21, but you have botocore 1.27.77 which is incompatible. |
| DEBUG:botocore.hooks:Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane |
| 2022-09-21 09:14:46,082 botocore.hooks [DEBUG] Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane |
| DEBUG:botocore.hooks:Changing event name from before-call.apigateway to before-call.api-gateway |
| 2022-09-21 09:14:46,085 botocore.hooks [DEBUG] Changing event name from before-call.apigateway to before-call.api-gateway |
| DEBUG:botocore.hooks:Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict |
| 2022-09-21 09:14:46,086 botocore.hooks [DEBUG] Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict |
| DEBUG:botocore.hooks:Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration 2022-09-21 09:14:46,088 botocore.hooks [DEBUG] Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration |
| DEBUG:botocore.hooks:Changing event name from before-parameter-build.route53 to before-parameter-build.route-53 2022-09-21 09:14:46,088 botocore.hooks [DEBUG] Changing event name from before-parameter-build.route53 to before-parameter-build.route-53 |
| DEBUG:botocore.hooks:Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search |
| 2022-09-21 09:14:46,089 botocore.hooks [DEBUG] Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search |
| DEBUG:botocore.hooks:Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section |
| 2022-09-21 09:14:46,090 botocore.hooks [DEBUG] Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section |
| DEBUG:botocore.hooks:Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask 2022-09-21 09:14:46,093 botocore.hooks [DEBUG] Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask |
| DEBUG:botocore.hooks:Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section |
| 2022-09-21 09:14:46,093 botocore.hooks [DEBUG] Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section |
| DEBUG:botocore.hooks:Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search |
| 2022-09-21 09:14:46,093 botocore.hooks [DEBUG] Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search |
| DEBUG:botocore.hooks:Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section |
| 2022-09-21 09:14:46,093 botocore.hooks [DEBUG] Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section |
| DEBUG:botocore.utils:IMDS ENDPOINT: http://169.254.169.254/ 2022-09-21 09:14:46,096 botocore.utils [DEBUG] IMDS ENDPOINT: http://169.254.169.254/ |
| DEBUG:botocore.credentials:Looking for credentials via: env 2022-09-21 09:14:46,097 botocore.credentials [DEBUG] Looking for credentials via: env |
| DEBUG:botocore.credentials:Looking for credentials via: assume-role |
| 2022-09-21 09:14:46,097 botocore.credentials [DEBUG] Looking for credentials via: assume-role |
| DEBUG:botocore.credentials:Looking for credentials via: assume-role-with-web-identity |
| 2022-09-21 09:14:46,097 botocore.credentials [DEBUG] Looking for credentials via: assume-role-with-web-identity |
| DEBUG:botocore.credentials:Looking for credentials via: sso |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: sso |
| DEBUG:botocore.credentials:Looking for credentials via: shared-credentials-file |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file |
| DEBUG:botocore.credentials:Looking for credentials via: custom-process |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: custom-process |
| DEBUG:botocore.credentials:Looking for credentials via: config-file |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: config-file |
| DEBUG:botocore.credentials:Looking for credentials via: ec2-credentials-file |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: ec2-credentials-file |
| DEBUG:botocore.credentials:Looking for credentials via: boto-config 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: boto-config |
| DEBUG:botocore.credentials:Looking for credentials via: container-role |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: container-role |
| DEBUG:botocore.credentials:Looking for credentials via: iam-role |
| 2022-09-21 09:14:46,098 botocore.credentials [DEBUG] Looking for credentials via: iam-role |
| DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 169.254.169.254:80 2022-09-21 09:14:46,104 urllib3.connectionpool [DEBUG] Starting new HTTP connection (1): 169.254.169.254:80 |
| DEBUG:urllib3.connectionpool:http://169.254.169.254:80 "PUT /latest/api/token HTTP/1.1" 404 50 |
| 2022-09-21 09:14:46,107 urllib3.connectionpool [DEBUG] http://169.254.169.254:80 "PUT /latest/api/token HTTP/1.1" 404 50 |
| DEBUG:urllib3.connectionpool:Resetting dropped connection: 169.254.169.254 |
| 2022-09-21 09:14:46,108 urllib3.connectionpool [DEBUG] Resetting dropped connection: 169.254.169.254 |
| DEBUG:urllib3.connectionpool:http://169.254.169.254:80 "GET /latest/meta-data/iam/security-credentials/ HTTP/1.1" 200 5 2022-09-21 09:14:46,110 urllib3.connectionpool [DEBUG] http://169.254.169.254:80 "GET /latest/meta-data/iam/security-credentials/ HTTP/1.1" 200 5 |
| DEBUG:urllib3.connectionpool:http://169.254.169.254:80 "GET /latest/meta-data/iam/security-credentials/dummy HTTP/1.1" 200 1014 2022-09-21 09:14:46,113 urllib3.connectionpool [DEBUG] http://169.254.169.254:80 "GET /latest/meta-data/iam/security-credentials/dummy HTTP/1.1" 200 1014 |
| DEBUG:botocore.utils:Unable to parse expiry_time in 2022-09-21T10:14:27.417Z 2022-09-21 09:14:46,158 botocore.utils [DEBUG] Unable to parse expiry_time in 2022-09-21T10:14:27.417Z |
| INFO:botocore.credentials:Found credentials from IAM Role: dummy |
| 2022-09-21 09:14:46,158 botocore.credentials [INFO] Found credentials from IAM Role: dummy |
| DEBUG:botocore.loaders:Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/endpoints.json |
| 2022-09-21 09:14:46,160 botocore.loaders [DEBUG] Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/endpoints.json |
| DEBUG:botocore.loaders:Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/sdk-default-configuration.json |
| 2022-09-21 09:14:46,172 botocore.loaders [DEBUG] Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/sdk-default-configuration.json |
| DEBUG:botocore.hooks:Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f26d6816550> |
| 2022-09-21 09:14:46,173 botocore.hooks [DEBUG] Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f26d6816550> |
| DEBUG:botocore.loaders:Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/lakeformation/2017-03-31/service-2.json |
| 2022-09-21 09:14:46,183 botocore.loaders [DEBUG] Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/lakeformation/2017-03-31/service-2.json |
| DEBUG:botocore.hooks:Event creating-client-class.lakeformation: calling handler <function add_generate_presigned_url at 0x7f26d6890d30> |
| 2022-09-21 09:14:46,188 botocore.hooks [DEBUG] Event creating-client-class.lakeformation: calling handler <function add_generate_presigned_url at 0x7f26d6890d30> |
| DEBUG:botocore.endpoint:Setting lakeformation timeout as (60, 60) |
| 2022-09-21 09:14:46,190 botocore.endpoint [DEBUG] Setting lakeformation timeout as (60, 60) |
| DEBUG:botocore.loaders:Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/_retry.json |
| 2022-09-21 09:14:46,191 botocore.loaders [DEBUG] Loading JSON file: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/botocore/data/_retry.json |
| DEBUG:botocore.client:Registering retry handlers for service: lakeformation |
| 2022-09-21 09:14:46,192 botocore.client [DEBUG] Registering retry handlers for service: lakeformation |
| DEBUG:botocore.hooks:Event before-parameter-build.lakeformation.SearchTablesByLFTags: calling handler <function generate_idempotent_uuid at 0x7f26d65a5ca0> |
| 2022-09-21 09:14:46,193 botocore.hooks [DEBUG] Event before-parameter-build.lakeformation.SearchTablesByLFTags: calling handler <function generate_idempotent_uuid at 0x7f26d65a5ca0> |
| DEBUG:botocore.hooks:Event before-call.lakeformation.SearchTablesByLFTags: calling handler <function add_recursion_detection_header at 0x7f26d65a5940> 2022-09-21 09:14:46,194 botocore.hooks [DEBUG] Event before-call.lakeformation.SearchTablesByLFTags: calling handler <function add_recursion_detection_header at 0x7f26d65a5940> DEBUG:botocore.hooks:Event before-call.lakeformation.SearchTablesByLFTags: calling handler <function inject_api_version_header_if_needed at 0x7f26d65aa550> 2022-09-21 09:14:46,194 botocore.hooks [DEBUG] Event before-call.lakeformation.SearchTablesByLFTags: calling handler <function inject_api_version_header_if_needed at 0x7f26d65aa550> DEBUG:botocore.endpoint:Making request for OperationModel(name=SearchTablesByLFTags) with params: {'url_path': '/SearchTablesByLFTags', 'query_string': {}, 'method': 'POST', 'headers': {'Content-Type': 'application/json', 'User-Agent': 'Boto3/1.24.75 Python/3.9.10 Linux/4.14.238-125.422.amzn1.x86_64 Botocore/1.27.77'}, 'body': b'{"CatalogId": "083536504398", "Expression": [{"TagKey": "services", "TagValues": ["CODIR"]}]}', 'url': 'https://lakeformation.eu-west-1.amazonaws.com/SearchTablesByLFTags', 'context': {'client_region': 'eu-west-1', 'client_config': <botocore.config.Config object at 0x7f26d5c6c400>, 'has_streaming_input': False, 'auth_type': None}} 2022-09-21 09:14:46,194 botocore.endpoint [DEBUG] Making request for OperationModel(name=SearchTablesByLFTags) with params: {'url_path': '/SearchTablesByLFTags', 'query_string': {}, 'method': 'POST', 'headers': {'Content-Type': 'application/json', 'User-Agent': 'Boto3/1.24.75 Python/3.9.10 Linux/4.14.238-125.422.amzn1.x86_64 Botocore/1.27.77'}, 'body': b'{"CatalogId": "083536504398", "Expression": [{"TagKey": "services", "TagValues": ["CODIR"]}]}', 'url': 'https://lakeformation.eu-west-1.amazonaws.com/SearchTablesByLFTags', 'context': {'client_region': 'eu-west-1', 'client_config': <botocore.config.Config object at 0x7f26d5c6c400>, 'has_streaming_input': False, 'auth_type': None}} DEBUG:botocore.hooks:Event request-created.lakeformation.SearchTablesByLFTags: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f26d5c6c2e0>> 2022-09-21 09:14:46,194 botocore.hooks [DEBUG] Event request-created.lakeformation.SearchTablesByLFTags: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f26d5c6c2e0>> |
| DEBUG:botocore.hooks:Event choose-signer.lakeformation.SearchTablesByLFTags: calling handler <function set_operation_specific_signer at 0x7f26d65a5b80> |
| 2022-09-21 09:14:46,195 botocore.hooks [DEBUG] Event choose-signer.lakeformation.SearchTablesByLFTags: calling handler <function set_operation_specific_signer at 0x7f26d65a5b80> |
| DEBUG:botocore.auth:Calculating signature using v4 auth. |
| 2022-09-21 09:14:46,195 botocore.auth [DEBUG] Calculating signature using v4 auth. |
| DEBUG:botocore.auth:CanonicalRequest: POST /SearchTablesByLFTags content-type:application/json host:lakeformation.eu-west-1.amazonaws.com x-amz-date:20220921T091446Z x-amz-security-token:XXXXXX content-type;host;x-amz-date;x-amz-security-token XXXXXXX |
| 2022-09-21 09:14:46,195 botocore.auth [DEBUG] CanonicalRequest: POST /SearchTablesByLFTags content-type:application/json host:lakeformation.eu-west-1.amazonaws.com x-amz-date:20220921T091446Z x-amz-security-token:XXXXXX, content-type;host;x-amz-date;x-amz-security-token XXXXXXXX |
| DEBUG:botocore.auth:StringToSign: AWS4-HMAC-SHA256 20220921T091446Z 20220921/eu-west-1/lakeformation/aws4_request dc2ebddaf634b4cbbccdd9e92269c554627fb2e05d1b62d991f88db0b4822b4b |
| 2022-09-21 09:14:46,196 botocore.auth [DEBUG] StringToSign: AWS4-HMAC-SHA256 20220921T091446Z 20220921/eu-west-1/lakeformation/aws4_request dc2ebddaf634b4cbbccdd9e92269c554627fb2e05d1b62d991f88db0b4822b4b |
| DEBUG:botocore.auth:Signature: ec050baba24a926e55557d1083479c04621368b3df085a6a2d313fecc1ab4e7b |
| 2022-09-21 09:14:46,196 botocore.auth [DEBUG] Signature: ec050baba24a926e55557d1083479c04621368b3df085a6a2d313fecc1ab4e7b |
| DEBUG:botocore.hooks:Event request-created.lakeformation.SearchTablesByLFTags: calling handler <function add_retry_headers at 0x7f26d65aac10> |
| 2022-09-21 09:14:46,196 botocore.hooks [DEBUG] Event request-created.lakeformation.SearchTablesByLFTags: calling handler <function add_retry_headers at 0x7f26d65aac10> |
| DEBUG:botocore.endpoint:Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://lakeformation.eu-west-1.amazonaws.com/SearchTablesByLFTags, headers={'Content-Type': b'application/json', 'User-Agent': b'Boto3/1.24.75 Python/3.9.10 Linux/4.14.238-125.422.amzn1.x86_64 Botocore/1.27.77', 'X-Amz-Date': b'20220921T091446Z', 'X-Amz-Security-Token': XXXXXX , 'Authorization': b'AWS4-HMAC-SHA256 Credential=ASIARG4ZJ4ZHFI5FLKWW/20220921/eu-west-1/lakeformation/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token, Signature=ec050baba24a926e55557d1083479c04621368b3df085a6a2d313fecc1ab4e7b', 'amz-sdk-invocation-id': b'0b89c3b0-42c8-471b-ac01-fd5f2cfe4c6a', 'amz-sdk-request': b'attempt=1', 'Content-Length': '93'}> |
| 2022-09-21 09:14:46,196 botocore.endpoint [DEBUG] Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://lakeformation.eu-west-1.amazonaws.com/SearchTablesByLFTags, headers={'Content-Type': b'application/json', 'User-Agent': b'Boto3/1.24.75 Python/3.9.10 Linux/4.14.238-125.422.amzn1.x86_64 Botocore/1.27.77', 'X-Amz-Date': b'20220921T091446Z', 'X-Amz-Security-Token': XXXXXXX, 'Authorization': b'AWS4-HMAC-SHA256 Credential=ASIARG4ZJ4ZHFI5FLKWW/20220921/eu-west-1/lakeformation/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token, Signature=ec050baba24a926e55557d1083479c04621368b3df085a6a2d313fecc1ab4e7b', 'amz-sdk-invocation-id': b'0b89c3b0-42c8-471b-ac01-fd5f2cfe4c6a', 'amz-sdk-request': b'attempt=1', 'Content-Length': '93'}> |
| DEBUG:botocore.httpsession:Certificate path: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/certifi/cacert.pem 2022-09-21 09:14:46,197 botocore.httpsession [DEBUG] Certificate path: /.pyenv/versions/python39_loaded/lib/python3.9/site-packages/certifi/cacert.pem |
| DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): lakeformation.eu-west-1.amazonaws.com:443 |
| 2022-09-21 09:14:46,198 urllib3.connectionpool [DEBUG] Starting new HTTPS connection (1): lakeformation.eu-west-1.amazonaws.com:443 |
| DEBUG:urllib3.connectionpool:https://lakeformation.eu-west-1.amazonaws.com:443 "POST /SearchTablesByLFTags HTTP/1.1" 200 143 2022-09-21 09:14:46,319 urllib3.connectionpool [DEBUG] https://lakeformation.eu-west-1.amazonaws.com:443 "POST /SearchTablesByLFTags HTTP/1.1" 200 143 |
| DEBUG:botocore.parsers:Response headers: {'Date': 'Wed, 21 Sep 2022 09:14:46 GMT', 'Content-Type': 'application/json', 'Content-Length': '143', 'Connection': 'keep-alive', 'x-amzn-RequestId': '5d9ab565-663b-413b-aeea-8f050d565cad', 'Cache-Control': 'no-cache'} |
| 2022-09-21 09:14:46,320 botocore.parsers [DEBUG] Response headers: {'Date': 'Wed, 21 Sep 2022 09:14:46 GMT', 'Content-Type': 'application/json', 'Content-Length': '143', 'Connection': 'keep-alive', 'x-amzn-RequestId': '5d9ab565-663b-413b-aeea-8f050d565cad', 'Cache-Control': 'no-cache'} |
| DEBUG:botocore.parsers:Response body: b'{"NextToken":"eyJleHBpcmF0aW9uIjp7InNlY29uZHMiOjE2NjM4MzgwODYsIm5hbm9zIjozMTUwMDAwMDB9LCJzZWFyY2hBbGxUYWdzSW5UYWJsZXMiOnRydWV9","TableList":[]}' |
| 2022-09-21 09:14:46,320 botocore.parsers [DEBUG] Response body: b'{"NextToken":"eyJleHBpcmF0aW9uIjp7InNlY29uZHMiOjE2NjM4MzgwODYsIm5hbm9zIjozMTUwMDAwMDB9LCJzZWFyY2hBbGxUYWdzSW5UYWJsZXMiOnRydWV9","TableList":[]}' |
| DEBUG:botocore.hooks:Event needs-retry.lakeformation.SearchTablesByLFTags: calling handler <botocore.retryhandler.RetryHandler object at 0x7f26d5c6cd90> |
| 2022-09-21 09:14:46,320 botocore.hooks [DEBUG] Event needs-retry.lakeformation.SearchTablesByLFTags: calling handler <botocore.retryhandler.RetryHandler object at 0x7f26d5c6cd90> |
| DEBUG:botocore.retryhandler:No retry needed. |
| 2022-09-21 09:14:46,321 botocore.retryhandler [DEBUG] No retry needed. |
Thanks @yanniouamara for following up. Both the AWS CLI and boto3 use the SearchTablesByLFTags API so the results should be consistent. Can you confirm that you're using the same profile in your boto3 script as when running the CLI command? Also I noticed an incompatibility message at the top of your logs, I don't know if that would explain things here but it could cause inconsistent results.
Yes @tim-finnigan , this error happens when i choose the boto version 1.24.75 in Glue parameters, i used the same version for the AWS CLI command. Without forcing the version of boto3, i don't have the error but still the empty TableList
.
The profiles should be the same, i'm in a saml configuration for credentials. Boto3 use the current session profile in the AWS Console, right ? For the AWS CLI, the profile is explicit and the same as the one for which I logged into the AWS Console.
@yanniouamara Here is the boto3 documentation on configuring credentials and the AWS CLI documentation as well. In the boto3 documentation it shows the order of precedence in which it looks for credentials. You may have the same profile configured for both, but I wasn't sure if you were passing a different --profile
in your AWS CLI command.
As I mentioned the behavior between the AWS CLI and boto3 (and other AWS SDKs) should be consistent as they each rely on the upstream service API model definitions. I also didn't see any boto3 errors in your debug logs. I would again check on the profile you're using for boto3. Also you may considering updating or reinstalling boto3 to ensure you have the latest service API models. You could also consider reaching out directly to AWS Support as they could probably help look into account-specific information and provide guidance.
@tim-finnigan Yes, there are different ways of putting credentials.
For my AWS Glue Job script, i let empty the session = boto3.Session()
because i'm being logged to the profile saml-power-user of our AWS Account.
For testing it locally with the CLI, i used the --profile saml-power-user
with this time some result for my function search_tables_by_lf_tags
.
To add some strength to my test, i explicitly used the ACCESS_KEY
, SECRET_KEY
and SESSION_TOKEN
in my Glue Script used by the AWS CLI, with still an empty result.
Thus i conclude that boto3 isn't working the same way in AWS Console and AWS CLI.
Hi @yanniouamara thanks for following up. Are you still seeing this issue? As previously mentioned the CLI and boto3 both share the same service API models so the functionality should be consistent. If you're seeing different results then it is likely due to a versioning issue or difference in profiles used.
Hi @tim-finnigan ,
I'm having the exact same issue. I've tried to run the CLI command with debug to analyse what's happening compared to the debug log of boto.
It appears that the CLI is performing a second api call using the NextToken. If I do the same in boto (: a first call with an empty TableList but with a NextToken and a second call with the provided NextToken I get the list of Tables) Why this second call is not performed by boto ?
Here's the log of CLI (I've cleaned the output)
2022-11-22 20:04:01,251 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64
2022-11-22 20:04:01,251 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['lakeformation', 'search-tables-by-lf-tags', '--debug', '--expression', 'TagKey=amp_table_gcd_amp_dev_datahub_cloudevents_store,TagValues=all_events_backups']
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_s3 at 0x10526a950>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_ddb at 0x104ea8670>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.configure.configure.ConfigureCommand'>>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x104e16c20>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x104e17b50>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function alias_opsworks_cm at 0x10527d2d0>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_history_commands at 0x104ee2050>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.devcommands.CLIDevCommand'>>
2022-11-22 20:04:01,273 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_waiters at 0x10527c550>
2022-11-22 20:04:01,274 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/data/cli.json
2022-11-22 20:04:01,274 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_types at 0x1051b9990>
2022-11-22 20:04:01,274 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function no_sign_request at 0x1051ba4d0>
2022-11-22 20:04:01,274 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_verify_ssl at 0x1051ba440>
2022-11-22 20:04:01,274 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_read_timeout at 0x1051ba5f0>
2022-11-22 20:04:01,274 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_connect_timeout at 0x1051ba560>
2022-11-22 20:04:01,274 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <built-in method update of dict object at 0x10532e340>
2022-11-22 20:04:01,275 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off
2022-11-22 20:04:01,275 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['lakeformation', 'search-tables-by-lf-tags', '--debug', '--expression', 'TagKey=amp_table_gcd_amp_dev_datahub_cloudevents_store,TagValues=all_events_backups']
2022-11-22 20:04:01,275 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x10526af80>
2022-11-22 20:04:01,275 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x104b6be20>
2022-11-22 20:04:01,275 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x1052e3250>
2022-11-22 20:04:01,275 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x104b69240>
2022-11-22 20:04:01,275 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x104bcc940>
2022-11-22 20:04:01,276 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2022-11-22 20:04:01,281 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x104ee1f30>
2022-11-22 20:04:01,282 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x104e6f520>
2022-11-22 20:04:01,290 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/data/lakeformation/2017-03-31/service-2.json
2022-11-22 20:04:01,293 - MainThread - botocore.hooks - DEBUG - Event building-command-table.lakeformation: calling handler <function add_waiters at 0x10527c550>
2022-11-22 20:04:01,302 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('next-token', <awscli.arguments.CLIArgument object at 0x1054e0040>), ('max-results', <awscli.arguments.CLIArgument object at 0x1054e0070>), ('catalog-id', <awscli.arguments.CLIArgument object at 0x1054e00a0>), ('expression', <awscli.arguments.ListArgument object at 0x1054e00d0>)])
2022-11-22 20:04:01,302 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lakeformation.search-tables-by-lf-tags: calling handler <function add_streaming_output_arg at 0x10526b250>
2022-11-22 20:04:01,302 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lakeformation.search-tables-by-lf-tags: calling handler <function add_cli_input_json at 0x104bcd120>
2022-11-22 20:04:01,302 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lakeformation.search-tables-by-lf-tags: calling handler <function add_cli_input_yaml at 0x104bcd360>
2022-11-22 20:04:01,302 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lakeformation.search-tables-by-lf-tags: calling handler <function unify_paging_params at 0x104ea8b80>
2022-11-22 20:04:01,312 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/data/lakeformation/2017-03-31/paginators-1.json
2022-11-22 20:04:01,312 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/data/lakeformation/2017-03-31/paginators-1.sdk-extras.json
2022-11-22 20:04:01,312 - MainThread - awscli.customizations.paginate - DEBUG - Modifying paging parameters for operation: SearchTablesByLFTags
2022-11-22 20:04:01,312 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lakeformation.search-tables-by-lf-tags: calling handler <function add_generate_skeleton at 0x1051b8f70>
2022-11-22 20:04:01,312 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.lakeformation.search-tables-by-lf-tags: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x1054e01c0>>
2022-11-22 20:04:01,312 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.lakeformation.search-tables-by-lf-tags: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x1054e01f0>>
2022-11-22 20:04:01,312 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.lakeformation.search-tables-by-lf-tags: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1054e0490>>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event operation-args-parsed.lakeformation.search-tables-by-lf-tags: calling handler functools.partial(<function check_should_enable_pagination at 0x104ea8ca0>, ['next-token', 'max-results'], {}, OrderedDict([('next-token', <awscli.arguments.CLIArgument object at 0x1054e0040>), ('max-results', <awscli.arguments.CLIArgument object at 0x1054e0070>), ('catalog-id', <awscli.arguments.CLIArgument object at 0x1054e00a0>), ('expression', <awscli.arguments.ListArgument object at 0x1054e00d0>), ('cli-input-json', <awscli.customizations.cliinput.CliInputJSONArgument object at 0x1054e01c0>), ('cli-input-yaml', <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x1054e01f0>), ('starting-token', <awscli.customizations.paginate.PageArgument object at 0x1054e0430>), ('page-size', <awscli.customizations.paginate.PageArgument object at 0x1054e0340>), ('max-items', <awscli.customizations.paginate.PageArgument object at 0x1054e0400>), ('generate-cli-skeleton', <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1054e0490>)]))
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.next-token: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.max-results: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.catalog-id: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.expression: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.lakeformation.search-tables-by-lf-tags: calling handler <awscli.argprocess.ParamShorthandParser object at 0x104b93280>
2022-11-22 20:04:01,313 - MainThread - awscli.argprocess - DEBUG - Parsing param --expression as shorthand
2022-11-22 20:04:01,313 - MainThread - awscli.arguments - DEBUG - Unpacked value of ['TagKey=amp_table_gcd_amp_dev_datahub_cloudevents_store,TagValues=all_events_backups'] for parameter "expression": [{'TagKey': 'amp_table_gcd_amp_dev_datahub_cloudevents_store', 'TagValues': ['all_events_backups']}]
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.cli-input-yaml: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.starting-token: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.page-size: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.max-items: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lakeformation.search-tables-by-lf-tags.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x10534ff40>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event calling-command.lakeformation.search-tables-by-lf-tags: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputJSONArgument object at 0x1054e01c0>>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event calling-command.lakeformation.search-tables-by-lf-tags: calling handler <bound method CliInputArgument.add_to_call_parameters of <awscli.customizations.cliinput.CliInputYAMLArgument object at 0x1054e01f0>>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event calling-command.lakeformation.search-tables-by-lf-tags: calling handler <bound method GenerateCliSkeletonArgument.generate_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x1054e0490>>
2022-11-22 20:04:01,313 - MainThread - botocore.hooks - DEBUG - Event calling-command.lakeformation.search-tables-by-lf-tags: calling handler functools.partial(<function check_should_enable_pagination_call_parameters at 0x104ea9090>, ['NextToken', 'MaxResults'])
2022-11-22 20:04:01,313 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2022-11-22 20:04:01,313 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2022-11-22 20:04:01,313 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role-with-web-identity
2022-11-22 20:04:01,313 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: sso
2022-11-22 20:04:01,313 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2022-11-22 20:04:01,314 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: custom-process
2022-11-22 20:04:01,369 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/data/endpoints.json
2022-11-22 20:04:01,373 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x103eacf70>
2022-11-22 20:04:01,374 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.lakeformation: calling handler <function add_generate_presigned_url at 0x103e2f7f0>
2022-11-22 20:04:01,481 - MainThread - botocore.endpoint - DEBUG - Setting lakeformation timeout as (60, 60)
2022-11-22 20:04:01,482 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.lakeformation.SearchTablesByLFTags: calling handler <function base64_decode_input_blobs at 0x1052e39a0>
2022-11-22 20:04:01,482 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.lakeformation.SearchTablesByLFTags: calling handler <function generate_idempotent_uuid at 0x103eaef80>
2022-11-22 20:04:01,483 - MainThread - botocore.hooks - DEBUG - Event before-call.lakeformation.SearchTablesByLFTags: calling handler <function inject_api_version_header_if_needed at 0x103ed8820>
2022-11-22 20:04:01,483 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=SearchTablesByLFTags) with params: {'url_path': '/SearchTablesByLFTags', 'query_string': {}, 'method': 'POST', 'headers': {'Content-Type': 'application/json', 'User-Agent': 'aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off command/lakeformation.search-tables-by-lf-tags'}, 'body': b'{"Expression": [{"TagKey": "amp_table_gcd_amp_dev_datahub_cloudevents_store", "TagValues": ["all_events_backups"]}]}', 'url': 'https://lakeformation.eu-central-1.amazonaws.com/SearchTablesByLFTags', 'context': {'client_region': 'eu-central-1', 'client_config': <botocore.config.Config object at 0x1054e0f10>, 'has_streaming_input': False, 'auth_type': None}}
2022-11-22 20:04:01,483 - MainThread - botocore.hooks - DEBUG - Event request-created.lakeformation.SearchTablesByLFTags: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x1054e3040>>
2022-11-22 20:04:01,483 - MainThread - botocore.hooks - DEBUG - Event choose-signer.lakeformation.SearchTablesByLFTags: calling handler <function set_operation_specific_signer at 0x103eaee60>
2022-11-22 20:04:01,485 - MainThread - botocore.credentials - DEBUG - Credentials were found in cache, but they are expired.
2022-11-22 20:04:01,485 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x103eacf70>
2022-11-22 20:04:01,485 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/data/sts/2011-06-15/service-2.json
2022-11-22 20:04:01,486 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.sts: calling handler <function add_generate_presigned_url at 0x103e2f7f0>
2022-11-22 20:04:01,529 - MainThread - botocore.endpoint - DEBUG - Setting sts timeout as (60, 60)
2022-11-22 20:04:01,530 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.sts.AssumeRole: calling handler <function base64_decode_input_blobs at 0x1052e39a0>
2022-11-22 20:04:01,530 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.sts.AssumeRole: calling handler <function generate_idempotent_uuid at 0x103eaef80>
2022-11-22 20:04:01,530 - MainThread - botocore.hooks - DEBUG - Event before-call.sts.AssumeRole: calling handler <function inject_api_version_header_if_needed at 0x103ed8820>
2022-11-22 20:04:01,530 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=AssumeRole) with params: {'url_path': '/', 'query_string': '', 'method': 'POST', 'headers': {'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': 'aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off command/lakeformation.search-tables-by-lf-tags'}, 'body': {'Action': 'AssumeRole', 'Version': '2011-06-15', 'RoleArn': 'arn:aws:iam::893328571881:role/role-amp_dev-manager-backend-lambda-datalake', 'RoleSessionName': 'botocore-session-1669143841'}, 'url': 'https://sts.eu-central-1.amazonaws.com/', 'context': {'client_region': 'eu-central-1', 'client_config': <botocore.config.Config object at 0x1058f8a60>, 'has_streaming_input': False, 'auth_type': None}}
2022-11-22 20:04:01,530 - MainThread - botocore.hooks - DEBUG - Event request-created.sts.AssumeRole: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x1058f8a30>>
2022-11-22 20:04:01,530 - MainThread - botocore.hooks - DEBUG - Event choose-signer.sts.AssumeRole: calling handler <function set_operation_specific_signer at 0x103eaee60>
2022-11-22 20:04:01,530 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2022-11-22 20:04:01,530 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/
content-type:application/x-www-form-urlencoded; charset=utf-8
host:sts.eu-central-1.amazonaws.com
x-amz-date:20221122T190401Z
content-type;host;x-amz-date
35ff30a594ae5bd0f199e933466aa18698ab01b6f0f6c059c839974f19a539d3
2022-11-22 20:04:01,530 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20221122T190401Z
20221122/eu-central-1/sts/aws4_request
588931e6b3560e773259fd989715a22a8ae1505348f2a47a41746d20f31d0e28
2022-11-22 20:04:01,531 - MainThread - botocore.auth - DEBUG - Signature:
da54f01d0a9800235898732aec2fb833437c348aea130060f425d6793a29c869
2022-11-22 20:04:01,531 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://sts.eu-central-1.amazonaws.com/, headers={'Content-Type': b'application/x-www-form-urlencoded; charset=utf-8', 'User-Agent': b'aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off command/lakeformation.search-tables-by-lf-tags', 'X-Amz-Date': b'20221122T190401Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=AKIAX6G2CGGNB7MCQCWI/20221122/eu-central-1/sts/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=da54f01d0a9800235898732aec2fb833437c348aea130060f425d6793a29c869', 'Content-Length': '176'}>
2022-11-22 20:04:01,531 - MainThread - botocore.httpsession - DEBUG - Certificate path: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/cacert.pem
2022-11-22 20:04:01,531 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): sts.eu-central-1.amazonaws.com:443
2022-11-22 20:04:01,652 - MainThread - urllib3.connectionpool - DEBUG - https://sts.eu-central-1.amazonaws.com:443 "POST / HTTP/1.1" 200 1545
2022-11-22 20:04:01,653 - MainThread - botocore.parsers - DEBUG - Response headers: {'x-amzn-RequestId': '415b0fd8-aa46-4028-af9e-ceae7095cb10', 'Content-Type': 'text/xml', 'Content-Length': '1545', 'Date': 'Tue, 22 Nov 2022 19:04:00 GMT'}
2022-11-22 20:04:01,653 - MainThread - botocore.parsers - DEBUG - Response body:
b'<AssumeRoleResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">\n <AssumeRoleResult>\n <AssumedRoleUser>\n <AssumedRoleId>AROA477UIHXU7M4PAI4RC:botocore-session-1669143841</AssumedRoleId>\n <Arn>arn:aws:sts::893328571881:assumed-role/role-amp_dev-manager-backend-lambda-datalake/botocore-session-1669143841</Arn>\n </AssumedRoleUser>\n <Credentials>\n <AccessKeyId>ASIA477UIHXUZMPVS4GV</AccessKeyId>\n <SecretAccessKey>QyXUVcX+DvNuEhL/gmAjeomgvbUWjAUcJJ10nPR2</SecretAccessKey>\n <SessionToken>IQoJb3JpZ2luX2VjEKP//////////wEaDGV1LWNlbnRyYWwtMSJIMEYCIQDvxrdWJblGhcgI3N0P7JTRqwSgNyTR1DL7uQzmk+5yvQIhAOh8jTu+xbwNB316vD68CGMdbZcbQpTpfQUtVFe78FDLKrECCKz//////////wEQAhoMODkzMzI4NTcxODgxIgzQXmziMaFyV2VrbpAqhQIOBpDmSAoFoKp7bNerZDpbrezfFAxSQJB7yt3vYeoY6vmFgcEi0oqQywmvyU5hwCCsoKeBtWcRdq44B7+xMiQfm/lnF/My6uNtKii8q/QeWMUzx73s3c1OhwuzMb+3o+JJA65dWNL/3yxCujWMbqhHSxJNJwra1lOCV4s8fGfDcIzJBQIQLt+S5eER0JQb4KOKftXw4jJ6vuWWBLxBROh8KK8esB0wT77oavb0jMg++mwl2CIWqtcMpArFaqZ2h/ZIDYuWZ1icThHFhCDgqBSCn7EeoZPeEb+oF9xZpS5AkxhYhmCKT0ZIIS+QR5CFocWbpY41qf0bPTcKhV67G+oz1vEZp4Iwobr0mwY6nAEsp8nWQRXph70u9a6n3uIyTA7yTKN0X59h2KFH8J05Iqhhz5yx8vO7FfTQelJH+tZcHg0N+KIi2UL7my8w7iPcgEoIvWEbkVzWkIjxyAsgJe3FpHwIl63WUCixBh4S6MZlQ6FfR/3gfndEWDIzZkR4cw+DrOaK1A+qFiCpZ2K5UkFDa7YZQS5u72BR2EG/XJU44oN3OF3dZCaVg5s=</SessionToken>\n <Expiration>2022-11-22T20:04:01Z</Expiration>\n </Credentials>\n </AssumeRoleResult>\n <ResponseMetadata>\n <RequestId>415b0fd8-aa46-4028-af9e-ceae7095cb10</RequestId>\n </ResponseMetadata>\n</AssumeRoleResponse>\n'
2022-11-22 20:04:01,654 - MainThread - botocore.hooks - DEBUG - Event needs-retry.sts.AssumeRole: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x1058f9420>>
2022-11-22 20:04:01,654 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2022-11-22 20:04:01,654 - MainThread - botocore.hooks - DEBUG - Event after-call.sts.AssumeRole: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x1058f8a90>>
2022-11-22 20:04:01,656 - MainThread - botocore.credentials - DEBUG - Retrieved credentials will expire at: 2022-11-22 20:04:01+00:00
2022-11-22 20:04:01,656 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2022-11-22 20:04:01,656 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/SearchTablesByLFTags
content-type:application/json
host:lakeformation.eu-central-1.amazonaws.com
x-amz-date:20221122T190401Z
x-amz-security-token:IQoJb3JpZ2luX2VjEKP//////////wEaDGV1LWNlbnRyYWwtMSJIMEYCIQDvxrdWJblGhcgI3N0P7JTRqwSgNyTR1DL7uQzmk+5yvQIhAOh8jTu+xbwNB316vD68CGMdbZcbQpTpfQUtVFe78FDLKrECCKz//////////wEQAhoMODkzMzI4NTcxODgxIgzQXmziMaFyV2VrbpAqhQIOBpDmSAoFoKp7bNerZDpbrezfFAxSQJB7yt3vYeoY6vmFgcEi0oqQywmvyU5hwCCsoKeBtWcRdq44B7+xMiQfm/lnF/My6uNtKii8q/QeWMUzx73s3c1OhwuzMb+3o+JJA65dWNL/3yxCujWMbqhHSxJNJwra1lOCV4s8fGfDcIzJBQIQLt+S5eER0JQb4KOKftXw4jJ6vuWWBLxBROh8KK8esB0wT77oavb0jMg++mwl2CIWqtcMpArFaqZ2h/ZIDYuWZ1icThHFhCDgqBSCn7EeoZPeEb+oF9xZpS5AkxhYhmCKT0ZIIS+QR5CFocWbpY41qf0bPTcKhV67G+oz1vEZp4Iwobr0mwY6nAEsp8nWQRXph70u9a6n3uIyTA7yTKN0X59h2KFH8J05Iqhhz5yx8vO7FfTQelJH+tZcHg0N+KIi2UL7my8w7iPcgEoIvWEbkVzWkIjxyAsgJe3FpHwIl63WUCixBh4S6MZlQ6FfR/3gfndEWDIzZkR4cw+DrOaK1A+qFiCpZ2K5UkFDa7YZQS5u72BR2EG/XJU44oN3OF3dZCaVg5s=
content-type;host;x-amz-date;x-amz-security-token
7392b354c79fc0a0dcc1cb22a1499b406f3ac6eaca6673a1bbe25adcb0332a67
2022-11-22 20:04:01,656 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20221122T190401Z
20221122/eu-central-1/lakeformation/aws4_request
cd47914d6f15d9173b07a2d5a5e95132c2df85b75b1bf214901286be0738c779
2022-11-22 20:04:01,657 - MainThread - botocore.auth - DEBUG - Signature:
947254cb68182318bb226ef6235473e1660fc137896c60254761232c9226986d
2022-11-22 20:04:01,657 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://lakeformation.eu-central-1.amazonaws.com/SearchTablesByLFTags, headers={'Content-Type': b'application/json', 'User-Agent': b'aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off command/lakeformation.search-tables-by-lf-tags', 'X-Amz-Date': b'20221122T190401Z', 'X-Amz-Security-Token': b'IQoJb3JpZ2luX2VjEKP//////////wEaDGV1LWNlbnRyYWwtMSJIMEYCIQDvxrdWJblGhcgI3N0P7JTRqwSgNyTR1DL7uQzmk+5yvQIhAOh8jTu+xbwNB316vD68CGMdbZcbQpTpfQUtVFe78FDLKrECCKz//////////wEQAhoMODkzMzI4NTcxODgxIgzQXmziMaFyV2VrbpAqhQIOBpDmSAoFoKp7bNerZDpbrezfFAxSQJB7yt3vYeoY6vmFgcEi0oqQywmvyU5hwCCsoKeBtWcRdq44B7+xMiQfm/lnF/My6uNtKii8q/QeWMUzx73s3c1OhwuzMb+3o+JJA65dWNL/3yxCujWMbqhHSxJNJwra1lOCV4s8fGfDcIzJBQIQLt+S5eER0JQb4KOKftXw4jJ6vuWWBLxBROh8KK8esB0wT77oavb0jMg++mwl2CIWqtcMpArFaqZ2h/ZIDYuWZ1icThHFhCDgqBSCn7EeoZPeEb+oF9xZpS5AkxhYhmCKT0ZIIS+QR5CFocWbpY41qf0bPTcKhV67G+oz1vEZp4Iwobr0mwY6nAEsp8nWQRXph70u9a6n3uIyTA7yTKN0X59h2KFH8J05Iqhhz5yx8vO7FfTQelJH+tZcHg0N+KIi2UL7my8w7iPcgEoIvWEbkVzWkIjxyAsgJe3FpHwIl63WUCixBh4S6MZlQ6FfR/3gfndEWDIzZkR4cw+DrOaK1A+qFiCpZ2K5UkFDa7YZQS5u72BR2EG/XJU44oN3OF3dZCaVg5s=', 'Authorization': b'AWS4-HMAC-SHA256 Credential=ASIA477UIHXUZMPVS4GV/20221122/eu-central-1/lakeformation/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token, Signature=947254cb68182318bb226ef6235473e1660fc137896c60254761232c9226986d', 'Content-Length': '116'}>
2022-11-22 20:04:01,657 - MainThread - botocore.httpsession - DEBUG - Certificate path: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/cacert.pem
2022-11-22 20:04:01,657 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): lakeformation.eu-central-1.amazonaws.com:443
2022-11-22 20:04:01,979 - MainThread - urllib3.connectionpool - DEBUG - https://lakeformation.eu-central-1.amazonaws.com:443 "POST /SearchTablesByLFTags HTTP/1.1" 200 143
2022-11-22 20:04:01,982 - MainThread - botocore.parsers - DEBUG - Response headers: {'Date': 'Tue, 22 Nov 2022 19:04:02 GMT', 'Content-Type': 'application/json', 'Content-Length': '143', 'Connection': 'keep-alive', 'x-amzn-RequestId': 'a924812b-2cd5-43ef-8cf4-8a4798fe9ca6', 'Cache-Control': 'no-cache'}
2022-11-22 20:04:01,982 - MainThread - botocore.parsers - DEBUG - Response body:
b'{"NextToken":"eyJleHBpcmF0aW9uIjp7InNlY29uZHMiOjE2NjkyMzAyNDIsIm5hbm9zIjo0NzAwMDAwMH0sInNlYXJjaEFsbFRhZ3NJblRhYmxlcyI6dHJ1ZX0=","TableList":[]}'
2022-11-22 20:04:01,983 - MainThread - botocore.hooks - DEBUG - Event needs-retry.lakeformation.SearchTablesByLFTags: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x1054e3af0>>
2022-11-22 20:04:01,983 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2022-11-22 20:04:01,983 - MainThread - botocore.hooks - DEBUG - Event after-call.lakeformation.SearchTablesByLFTags: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x1054e3010>>
2022-11-22 20:04:01,983 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.lakeformation.SearchTablesByLFTags: calling handler <function base64_decode_input_blobs at 0x1052e39a0>
2022-11-22 20:04:01,983 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.lakeformation.SearchTablesByLFTags: calling handler <function generate_idempotent_uuid at 0x103eaef80>
2022-11-22 20:04:01,983 - MainThread - botocore.hooks - DEBUG - Event before-call.lakeformation.SearchTablesByLFTags: calling handler <function inject_api_version_header_if_needed at 0x103ed8820>
2022-11-22 20:04:01,983 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=SearchTablesByLFTags) with params: {'url_path': '/SearchTablesByLFTags', 'query_string': {}, 'method': 'POST', 'headers': {'Content-Type': 'application/json', 'User-Agent': 'aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off command/lakeformation.search-tables-by-lf-tags'}, 'body': b'{"Expression": [{"TagKey": "amp_table_gcd_amp_dev_datahub_cloudevents_store", "TagValues": ["all_events_backups"]}], "NextToken": "eyJleHBpcmF0aW9uIjp7InNlY29uZHMiOjE2NjkyMzAyNDIsIm5hbm9zIjo0NzAwMDAwMH0sInNlYXJjaEFsbFRhZ3NJblRhYmxlcyI6dHJ1ZX0="}', 'url': 'https://lakeformation.eu-central-1.amazonaws.com/SearchTablesByLFTags', 'context': {'client_region': 'eu-central-1', 'client_config': <botocore.config.Config object at 0x1054e0f10>, 'has_streaming_input': False, 'auth_type': None}}
2022-11-22 20:04:01,984 - MainThread - botocore.hooks - DEBUG - Event request-created.lakeformation.SearchTablesByLFTags: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x1054e3040>>
2022-11-22 20:04:01,984 - MainThread - botocore.hooks - DEBUG - Event choose-signer.lakeformation.SearchTablesByLFTags: calling handler <function set_operation_specific_signer at 0x103eaee60>
2022-11-22 20:04:01,984 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2022-11-22 20:04:01,984 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/SearchTablesByLFTags
content-type:application/json
host:lakeformation.eu-central-1.amazonaws.com
x-amz-date:20221122T190401Z
x-amz-security-token:IQoJb3JpZ2luX2VjEKP//////////wEaDGV1LWNlbnRyYWwtMSJIMEYCIQDvxrdWJblGhcgI3N0P7JTRqwSgNyTR1DL7uQzmk+5yvQIhAOh8jTu+xbwNB316vD68CGMdbZcbQpTpfQUtVFe78FDLKrECCKz//////////wEQAhoMODkzMzI4NTcxODgxIgzQXmziMaFyV2VrbpAqhQIOBpDmSAoFoKp7bNerZDpbrezfFAxSQJB7yt3vYeoY6vmFgcEi0oqQywmvyU5hwCCsoKeBtWcRdq44B7+xMiQfm/lnF/My6uNtKii8q/QeWMUzx73s3c1OhwuzMb+3o+JJA65dWNL/3yxCujWMbqhHSxJNJwra1lOCV4s8fGfDcIzJBQIQLt+S5eER0JQb4KOKftXw4jJ6vuWWBLxBROh8KK8esB0wT77oavb0jMg++mwl2CIWqtcMpArFaqZ2h/ZIDYuWZ1icThHFhCDgqBSCn7EeoZPeEb+oF9xZpS5AkxhYhmCKT0ZIIS+QR5CFocWbpY41qf0bPTcKhV67G+oz1vEZp4Iwobr0mwY6nAEsp8nWQRXph70u9a6n3uIyTA7yTKN0X59h2KFH8J05Iqhhz5yx8vO7FfTQelJH+tZcHg0N+KIi2UL7my8w7iPcgEoIvWEbkVzWkIjxyAsgJe3FpHwIl63WUCixBh4S6MZlQ6FfR/3gfndEWDIzZkR4cw+DrOaK1A+qFiCpZ2K5UkFDa7YZQS5u72BR2EG/XJU44oN3OF3dZCaVg5s=
content-type;host;x-amz-date;x-amz-security-token
bf49b2653aa4ff3cee16ac7d2cf47928d0f720328fc04daeb71006be64a226e9
2022-11-22 20:04:01,984 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20221122T190401Z
20221122/eu-central-1/lakeformation/aws4_request
1afcf6fdb19a62f1561d81f5d65a6958de6016a6741bb56d8afbaad3ab143d92
2022-11-22 20:04:01,984 - MainThread - botocore.auth - DEBUG - Signature:
a6959a894226eabdf5ae650ac5c8cd19faf968e87615d70072ac4793b7df4e25
2022-11-22 20:04:01,984 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://lakeformation.eu-central-1.amazonaws.com/SearchTablesByLFTags, headers={'Content-Type': b'application/json', 'User-Agent': b'aws-cli/2.7.31 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off command/lakeformation.search-tables-by-lf-tags', 'X-Amz-Date': b'20221122T190401Z', 'X-Amz-Security-Token': b'IQoJb3JpZ2luX2VjEKP//////////wEaDGV1LWNlbnRyYWwtMSJIMEYCIQDvxrdWJblGhcgI3N0P7JTRqwSgNyTR1DL7uQzmk+5yvQIhAOh8jTu+xbwNB316vD68CGMdbZcbQpTpfQUtVFe78FDLKrECCKz//////////wEQAhoMODkzMzI4NTcxODgxIgzQXmziMaFyV2VrbpAqhQIOBpDmSAoFoKp7bNerZDpbrezfFAxSQJB7yt3vYeoY6vmFgcEi0oqQywmvyU5hwCCsoKeBtWcRdq44B7+xMiQfm/lnF/My6uNtKii8q/QeWMUzx73s3c1OhwuzMb+3o+JJA65dWNL/3yxCujWMbqhHSxJNJwra1lOCV4s8fGfDcIzJBQIQLt+S5eER0JQb4KOKftXw4jJ6vuWWBLxBROh8KK8esB0wT77oavb0jMg++mwl2CIWqtcMpArFaqZ2h/ZIDYuWZ1icThHFhCDgqBSCn7EeoZPeEb+oF9xZpS5AkxhYhmCKT0ZIIS+QR5CFocWbpY41qf0bPTcKhV67G+oz1vEZp4Iwobr0mwY6nAEsp8nWQRXph70u9a6n3uIyTA7yTKN0X59h2KFH8J05Iqhhz5yx8vO7FfTQelJH+tZcHg0N+KIi2UL7my8w7iPcgEoIvWEbkVzWkIjxyAsgJe3FpHwIl63WUCixBh4S6MZlQ6FfR/3gfndEWDIzZkR4cw+DrOaK1A+qFiCpZ2K5UkFDa7YZQS5u72BR2EG/XJU44oN3OF3dZCaVg5s=', 'Authorization': b'AWS4-HMAC-SHA256 Credential=ASIA477UIHXUZMPVS4GV/20221122/eu-central-1/lakeformation/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-security-token, Signature=a6959a894226eabdf5ae650ac5c8cd19faf968e87615d70072ac4793b7df4e25', 'Content-Length': '245'}>
2022-11-22 20:04:01,985 - MainThread - botocore.httpsession - DEBUG - Certificate path: /opt/homebrew/Cellar/awscli/2.7.31/libexec/lib/python3.10/site-packages/awscli/botocore/cacert.pem
2022-11-22 20:04:02,359 - MainThread - urllib3.connectionpool - DEBUG - https://lakeformation.eu-central-1.amazonaws.com:443 "POST /SearchTablesByLFTags HTTP/1.1" 200 5941
2022-11-22 20:04:02,360 - MainThread - botocore.parsers - DEBUG - Response headers: {'Date': 'Tue, 22 Nov 2022 19:04:02 GMT', 'Content-Type': 'application/json', 'Content-Length': '5941', 'Connection': 'keep-alive', 'x-amzn-RequestId': '85810d62-8ea5-453c-bf8a-ecbe23d0b90c', 'Cache-Control': 'no-cache'}
2022-11-22 20:04:02,360 - MainThread - botocore.parsers - DEBUG - Response body:
b'{"NextToken":null,"TableList":[{............HIDDEN RESULTS...........}]}'
2022-11-22 20:04:02,367 - MainThread - botocore.hooks - DEBUG - Event needs-retry.lakeformation.SearchTablesByLFTags: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x1054e3af0>>
2022-11-22 20:04:02,367 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2022-11-22 20:04:02,367 - MainThread - botocore.hooks - DEBUG - Event after-call.lakeformation.SearchTablesByLFTags: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x1054e3010>>
@frco9 I think what you're describing is explained by the AWS CLI default pagination behavior. For boto3 you would use this paginator, and you can find more information on boto3 paginators here. I hope that helps - please let me know if you had any follow up questions.
@tim-finnigan ok for the paginator indeed it solve the diff between cli and boto. But what I'm not understanding is the API behavior in that case ? Why would it return an empty response on first page and results on page 2. It seems weird and not usual. I don't have this behavior with other endpoints.
@frco9 I think what you're describing is different than the original issue reported here. If you're using filters then it may be related to https://github.com/boto/boto3/issues/2643.
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.
Hi @yanniouamara thanks for following up. Are you still seeing this issue? As previously mentioned the CLI and boto3 both share the same service API models so the functionality should be consistent. If you're seeing different results then it is likely due to a versioning issue or difference in profiles used.
Hi ! I found a workaround with Terraform that suits our use-case. If might need this command through AWS Glue Jobs in the future, i'll dig more when it comes.
Thanks for your reply - if you'd like to discuss this further please leave a comment here or create a new issue.