Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glue get_tables fails to return tables if QueryAsOfTime parameter is specified #4172

Closed
GabrielEisenbergOlympus opened this issue Jun 21, 2024 · 2 comments
Assignees
Labels
bug This issue is a confirmed bug. glue service-api This issue is caused by the service API, not the SDK implementation.

Comments

@GabrielEisenbergOlympus
Copy link

GabrielEisenbergOlympus commented Jun 21, 2024

Describe the bug

When calling get_tables without QueryAsOfTime being specified, tables are returned, however, when it is specified with either a datetime (Python native or with Pendulum), no tables are returned. Funny enough, this parameter works perfectly in get_table.

Expected Behavior

Obtain a list of tables, matching the input Expression for a given point in time as specified with QueryAsOfTime.

Current Behavior

The response contains an empty TableList:

{'TableList': [], 'ResponseMetadata': {'RequestId': 'FAKED-REQUEST-ID', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Fri, 21 Jun 2024 07:54:34 GMT', 'content-type': 'application/x-amz-json-1.1', 'content-length': '16', 'connection': 'keep-alive', 'x-amzn-requestid': 'FAKED-REQUEST-ID'}, 'RetryAttempts': 0}}

Reproduction Steps

import boto3
import pendulum as pd

client = boto3.client("glue", region_name="af-south-1") # Perhaps the region contributes to this issue, hence the specification.
query_as_of_time = pd.datetime(
    year=2024, month=6, day=14, hour=0, minute=54, second=0, tz="Africa/Johannesburg"
) # Experience the same behavior with datetime.datetime or a timestamp equivalent value

response = client.get_tables(
        DatabaseName="glue_database",
        Expression=f"^glue_table$",
        QueryAsOfTime=query_as_of_time,
    )

print(response)

Possible Solution

Mimic the use of the parameter in get_table as this works perfectly.

Additional Information/Context

I have also tried adding a capture group to Expression which did not change the response when QueryAsOfTime was set,

SDK version used

1.34.131 on Python 3.11.9

Environment details (OS name and version, etc.)

Windows 11

@GabrielEisenbergOlympus GabrielEisenbergOlympus added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Jun 21, 2024
@tim-finnigan tim-finnigan self-assigned this Jun 21, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out. I similarly do not see results when specifying QueryAsOfTime. The Boto3 get_tables command involves a call to the underlying GetTables API, so I'll need to reach out to the Glue team for more information here.

Here is the API documentation for this parameter:

image

And the Boto3 docs use QueryAsOfTime=datetime(2015, 1, 1) as an example. I tested with datetime in us-west-2 some I'm not sure the region is a factor here:

import boto3
from datetime import datetime

client = boto3.client("glue")

response = client.get_tables(
    DatabaseName="gluedb",
    QueryAsOfTime=datetime(2023, 1, 1)
)

print(response)

When not specifying QueryAsOfTime, the datetime values in the results look like this:

datetime.datetime(2023, 1, 1, 1, 6, tzinfo=tzlocal())

So there appears to be some inconsistency here. I'll let you know when I have updates from the Glue team, and please refer to aws/aws-sdk#768 for updates going forward.

@tim-finnigan tim-finnigan added service-api This issue is caused by the service API, not the SDK implementation. glue and removed needs-triage This issue or PR still needs to be triaged. labels Jun 21, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. glue service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants