UNLOAD Athena query results as JSON with camelCase keys

0

Is it possible for Athena to UNLOAD the results, and retain the key names?

This seems to be really inconsistent.

When I do not use UNLOAD, and use the default Athena -> S3 as CSV output, then the header columns retain the names as camelCase.

When I do use UNLOAD, and use the JSON format, the keys get flattened for the same query.

UNLOAD (
		WITH dataset AS (
			SELECT 'engineering' as department,
				ARRAY [ 'Sharon',
				'John',
				'Bob',
				'Sally' ] as users
		)
		SELECT department AS "departmentName",
			names
		FROM dataset
			CROSS JOIN UNNEST(users) as t(names)
	) TO 's3://${YOUR_BUCKET}/unload/' WITH (format = 'JSON')

Result:

{"departmentname":"engineering","names":"Sharon"}
{"departmentname":"engineering","names":"John"}
{"departmentname":"engineering","names":"Bob"}
{"departmentname":"engineering","names":"Sally"}
profile picture
m0ltar
preguntada hace 10 meses71 visualizaciones
No hay respuestas

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas