aws-sdk-pandas
aws-sdk-pandas copied to clipboard
Unsupported Athena type: json
Describe the bug
When trying to run the Athena query with JSON_EXTRACT it returns an error: Unsupported Athena type: json. When running the query directly in Athena, it works. With awswrangler.athena.read_sql_query it doesn't work.
How to Reproduce
query = `
SELECT si.* ,se.id as session_id,
orga.name as organization_name,
FROM_UNIXTIME(se.actual_start_ts) as actual_start_ts,
JSON_EXTRACT(retention_policy, '$.aws_s3') as retention_policy_aws_s3,
CASE WHEN CAST(JSON_EXTRACT(cfg.retention_policy, '$.aws_s3') AS VARCHAR) = '-1' THEN false ELSE true END as has_policy,
JSON_EXTRACT(retention_policy, '$.django_be') as retention_policy_django_be
FROM eleos_rest_session as se
JOIN eleos_rest_treatmentplan as tp ON se.treatment_plan_id = tp.id
JOIN eleos_rest_therapist as th ON tp.therapist_id = th.id
JOIN eleos_rest_therapist_site as thsi ON th.id = thsi.therapist_id
JOIN eleos_rest_site as si ON si.id = thsi.site_id
JOIN eleos_rest_organization as orga ON orga.id = si.organization_id
JOIN eleos_rest_organizationconfiguration as cfg ON cfg.organization_id = orga.id`
result = wr.athena.read_sql_query(
sql=query,
database=self.credentials.get("schema"),
data_source=self.credentials.get("database"),
s3_output=self.credentials.get("s3StagingDir"),
ctas_approach=False,
boto3_session=self.boto3_session,
)
Expected behavior
No response
Your project
No response
Screenshots
No response
OS
Mac
Python version
3.10
AWS SDK for pandas version
3.5.2 but it didn't work also with 3.7.3
Additional context
No response