{"id":16423915,"url":"https://github.com/oliveroneill/bigqueryswift","last_synced_at":"2025-10-26T22:31:48.339Z","repository":{"id":55637844,"uuid":"156365982","full_name":"oliveroneill/BigQuerySwift","owner":"oliveroneill","description":"BigQuery client for Swift","archived":false,"fork":false,"pushed_at":"2019-04-29T09:50:42.000Z","size":21,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T00:51:08.299Z","etag":null,"topics":["bigquery","google-cloud-platform","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/oliveroneill.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}},"created_at":"2018-11-06T10:24:53.000Z","updated_at":"2024-09-06T11:15:34.000Z","dependencies_parsed_at":"2022-08-15T05:10:26.850Z","dependency_job_id":null,"html_url":"https://github.com/oliveroneill/BigQuerySwift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliveroneill%2FBigQuerySwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliveroneill%2FBigQuerySwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliveroneill%2FBigQuerySwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliveroneill%2FBigQuerySwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliveroneill","download_url":"https://codeload.github.com/oliveroneill/BigQuerySwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238408495,"owners_count":19467101,"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":["bigquery","google-cloud-platform","swift"],"created_at":"2024-10-11T07:41:16.986Z","updated_at":"2025-10-26T22:31:43.024Z","avatar_url":"https://github.com/oliveroneill.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BigQuerySwift\n\n[![Build Status](https://travis-ci.org/oliveroneill/BigQuerySwift.svg?branch=master)](https://travis-ci.org/oliveroneill/BigQuerySwift)\n[![Platform](https://img.shields.io/badge/Swift-4.2-orange.svg)](https://img.shields.io/badge/Swift-4.2-orange.svg)\n[![Swift Package Manager](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)\n![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)\n![Linux](https://img.shields.io/badge/os-linux-green.svg?style=flat)\n\nA [BigQuery](https://cloud.google.com/bigquery/) client for Swift.\n\n## Installation\nAdd this to your Package.swift:\n\n```swift\n.package(url: \"https://github.com/oliveroneill/BigQuerySwift.git\", .upToNextMajor(from: \"0.0.1\")),\n```\n\n## Usage\nTo get an authentication from your service account:\n```swift\nlet provider = BigQueryAuthProvider()\ntry! provider.getAuthenticationToken { response in\n    switch response {\n    case .token(let token):\n        // Your token to be passed into BigQueryClient\n        print(token)\n    case .error(_):\n        fatalError(\"Something went wrong.\")\n    }\n}\n```\nYou'll need to copy your credentials file at `$GOOGLE_APPLICATION_CREDENTIALS`\nto `credentials.json` in the directory that the binary is run in.\n\nTo insert:\n```swift\nlet client = BigQueryClient\u003cYourEncodableType\u003e(\n    authenticationToken: \"\u003cENTER-AUTHENTICATION-TOKEN\u003e\",\n    projectID: \"\u003cENTER-PROJECT-ID\u003e\",\n    datasetID: \"\u003cENTER-DATASET-ID\u003e\",\n    tableName: \"\u003cENTER-TABLE-NAME\u003e\"\n)\ntry client.insert(rows: rows) { response in\n    switch response {\n    case .error(let error):\n        fatalError(\"Error: \" + error.localizedDescription)\n    case .bigQueryResponse(let response):\n        checkErrors(response.insertErrors)\n    }\n}\n```\n\nTo query:\n```swift\nlet query = \"SELECT * FROM users\"\ntry db.query(query) { (r: QueryCallResponse\u003cYourDecodableType\u003e) in\n    switch r {\n    case .error(let e):\n        fatalError(\"Something went wrong.\")\n    case .queryResponse(let result):\n        guard let result = result.rows else {\n            guard let errors = result.errors else {\n                fatalError(\"No errors and no rows.\")\n            }\n            print(\"BigQuery errors: \\(errors)\")\n            return\n        }\n        printQueryResult(result)\n    }\n}\n```\n\n## Examples\nFor a working example, see [here](https://github.com/oliveroneill/WiltCollector/blob/bigquery-switch/Sources/WiltCollectorCore/BigQuery.swift).\n\n## Contributing\nFeel free to help out. Currently only\n[insertAll](https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll)\nis supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliveroneill%2Fbigqueryswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliveroneill%2Fbigqueryswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliveroneill%2Fbigqueryswift/lists"}