{"id":16091001,"url":"https://github.com/abetomo/convert-athena-queryresults-to-array","last_synced_at":"2025-03-17T17:31:00.611Z","repository":{"id":32865675,"uuid":"144666689","full_name":"abetomo/Convert-Athena-QueryResults-to-Array","owner":"abetomo","description":"Convert AWS Athena QueryResults to Array.","archived":false,"fork":false,"pushed_at":"2024-12-12T06:16:21.000Z","size":168,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T02:10:38.083Z","etag":null,"topics":["array","athena","aws","convert","query","results"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abetomo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-14T04:02:43.000Z","updated_at":"2024-12-12T06:16:25.000Z","dependencies_parsed_at":"2023-02-10T07:01:54.201Z","dependency_job_id":"405c1af6-a403-4161-a90f-51b3ec0e56d2","html_url":"https://github.com/abetomo/Convert-Athena-QueryResults-to-Array","commit_stats":{"total_commits":42,"total_committers":2,"mean_commits":21.0,"dds":"0.19047619047619047","last_synced_commit":"5a10872fc7a8cfc18d9dd0676e95f2350718dd6a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abetomo%2FConvert-Athena-QueryResults-to-Array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abetomo%2FConvert-Athena-QueryResults-to-Array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abetomo%2FConvert-Athena-QueryResults-to-Array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abetomo%2FConvert-Athena-QueryResults-to-Array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abetomo","download_url":"https://codeload.github.com/abetomo/Convert-Athena-QueryResults-to-Array/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243871908,"owners_count":20361380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","athena","aws","convert","query","results"],"created_at":"2024-10-09T15:08:18.855Z","updated_at":"2025-03-17T17:31:00.264Z","avatar_url":"https://github.com/abetomo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Convert-Athena-QueryResults-to-Array\n\n[![Latest Stable Version](https://poser.pugx.org/abetomo/convert-athena-query-results-to-array/v/stable)](https://packagist.org/packages/abetomo/convert-athena-query-results-to-array)\n[![Test](https://github.com/abetomo/Convert-Athena-QueryResults-to-Array/actions/workflows/workflow.yml/badge.svg)](https://github.com/abetomo/Convert-Athena-QueryResults-to-Array/actions/workflows/workflow.yml)\n\nConvert AWS Athena QueryResults to Array.\nSince the response of GetQueryResults is complicated, it converts it to a simple array.\n\n## Installation\n```bash\n% composer require abetomo/convert-athena-query-results-to-array\n```\n\n## Usage\nConvert the response of GetQueryResults into an array.\n\n```php\n\u003c?php\n// ... startQueryExecution, etc.\n\n$getQueryResultsResponse = $athenaClient-\u003egetQueryResults([\n    'QueryExecutionId' =\u003e $queryExecutionId\n]);\nuse Abetomo\\ConvertAthenaQueryResultstoArray\\ConvertAthenaQueryResultstoArray;\nprint \"/// Original value\\n\";\nprint_r($getQueryResultsResponse-\u003eget('ResultSet'));\nprint \"\\n/// Convert to array \\n\";\nprint_r(ConvertAthenaQueryResultstoArray::convert(\n    $getQueryResultsResponse-\u003eget('ResultSet'),\n    true // $isSkipHeader\n));\n```\n\n## Example of results\n### Convert to array\n```\nArray\n(\n    [0] =\u003e Array\n        (\n            [account_id] =\u003e id1\n            [count] =\u003e 49\n        )\n\n    [1] =\u003e Array\n        (\n            [account_id] =\u003e id2\n            [count] =\u003e 68\n        )\n\n)\n```\n\n### Original value\n```\nArray\n(\n    [Rows] =\u003e Array\n        (\n            [0] =\u003e Array\n                (\n                    [Data] =\u003e Array\n                        (\n                            [0] =\u003e Array\n                                (\n                                    [VarCharValue] =\u003e account_id\n                                )\n\n                            [1] =\u003e Array\n                                (\n                                    [VarCharValue] =\u003e count\n                                )\n\n                        )\n\n                )\n\n            [1] =\u003e Array\n                (\n                    [Data] =\u003e Array\n                        (\n                            [0] =\u003e Array\n                                (\n                                    [VarCharValue] =\u003e id1\n                                )\n\n                            [1] =\u003e Array\n                                (\n                                    [VarCharValue] =\u003e 49\n                                )\n\n                        )\n\n                )\n\n            [2] =\u003e Array\n                (\n                    [Data] =\u003e Array\n                        (\n                            [0] =\u003e Array\n                                (\n                                    [VarCharValue] =\u003e id2\n                                )\n\n                            [1] =\u003e Array\n                                (\n                                    [VarCharValue] =\u003e 68\n                                )\n\n                        )\n\n                )\n\n        )\n\n    [ResultSetMetadata] =\u003e Array\n        (\n            [ColumnInfo] =\u003e Array\n                (\n                    [0] =\u003e Array\n                        (\n                            [CatalogName] =\u003e hive\n                            [SchemaName] =\u003e\n                            [TableName] =\u003e\n                            [Name] =\u003e account_id\n                            [Label] =\u003e account_id\n                            [Type] =\u003e varchar\n                            [Precision] =\u003e 2147483647\n                            [Scale] =\u003e 0\n                            [Nullable] =\u003e UNKNOWN\n                            [CaseSensitive] =\u003e 1\n                        )\n\n                    [1] =\u003e Array\n                        (\n                            [CatalogName] =\u003e hive\n                            [SchemaName] =\u003e\n                            [TableName] =\u003e\n                            [Name] =\u003e count\n                            [Label] =\u003e count\n                            [Type] =\u003e integer\n                            [Precision] =\u003e 10\n                            [Scale] =\u003e 0\n                            [Nullable] =\u003e UNKNOWN\n                            [CaseSensitive] =\u003e\n                        )\n\n                )\n\n        )\n\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabetomo%2Fconvert-athena-queryresults-to-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabetomo%2Fconvert-athena-queryresults-to-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabetomo%2Fconvert-athena-queryresults-to-array/lists"}