{"id":15295229,"url":"https://github.com/hckhanh/pg2bigquery","last_synced_at":"2026-01-06T01:04:07.226Z","repository":{"id":37002519,"uuid":"319507945","full_name":"hckhanh/pg2bigquery","owner":"hckhanh","description":"A CLI tool to convert query from PostgreSQL to BigQuery","archived":false,"fork":false,"pushed_at":"2023-01-24T17:03:57.000Z","size":1608,"stargazers_count":0,"open_issues_count":43,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T11:24:59.069Z","etag":null,"topics":["big","bigquery","google","pg","pgsql","postgres","postgres-tool","postgresql","postgresql-database","postgressql","query","query-parser","querybuilder","sql","sql-toolkit","sql-tools","tool","toolbox","toolkit","utility"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hckhanh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-08T02:55:06.000Z","updated_at":"2022-06-17T12:11:19.000Z","dependencies_parsed_at":"2023-02-13T23:35:26.909Z","dependency_job_id":null,"html_url":"https://github.com/hckhanh/pg2bigquery","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hckhanh%2Fpg2bigquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hckhanh%2Fpg2bigquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hckhanh%2Fpg2bigquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hckhanh%2Fpg2bigquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hckhanh","download_url":"https://codeload.github.com/hckhanh/pg2bigquery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245330907,"owners_count":20597865,"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":["big","bigquery","google","pg","pgsql","postgres","postgres-tool","postgresql","postgresql-database","postgressql","query","query-parser","querybuilder","sql","sql-toolkit","sql-tools","tool","toolbox","toolkit","utility"],"created_at":"2024-09-30T17:09:06.865Z","updated_at":"2026-01-06T01:04:07.196Z","avatar_url":"https://github.com/hckhanh.png","language":"TypeScript","readme":"# pg2bigquery\n\nA CLI tool to convert query from PostgreSQL to BigQuery\n\n[![deepcode](https://www.deepcode.ai/api/gh/badge?key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwbGF0Zm9ybTEiOiJnaCIsIm93bmVyMSI6Imhja2hhbmgiLCJyZXBvMSI6InBnMmJpZ3F1ZXJ5IiwiaW5jbHVkZUxpbnQiOmZhbHNlLCJhdXRob3JJZCI6Mjg0MzQsImlhdCI6MTYxNzQ5NzY2MX0.RKs5KwUX_1aAQz-K1LyWD7HvjGi3zcIHhb-CVdZckE4)](https://www.deepcode.ai/app/gh/hckhanh/pg2bigquery/_/dashboard?utm_content=gh%2Fhckhanh%2Fpg2bigquery)\n![Release](https://github.com/hckhanh/pg2bigquery/workflows/Release/badge.svg)\n[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/hckhanh/pg2bigquery.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/hckhanh/pg2bigquery/context:javascript)\n[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)\n[![Version](https://img.shields.io/npm/v/pg2bigquery.svg)](https://npmjs.org/package/pg2bigquery)\n[![Downloads/week](https://img.shields.io/npm/dw/pg2bigquery.svg)](https://npmjs.org/package/pg2bigquery)\n[![License](https://img.shields.io/npm/l/pg2bigquery.svg)](https://github.com/hckhanh/pg2bigquery/blob/master/package.json)\n\n# Installation\n\nFor npm:\n\n```shell\nnpm i -g pg2bigquery\n```\n\nor yarn:\n\n```shell\nyarn global add pg2bigquery\n```\n\n# Usage\n\n## Requirements\n\n```sh-session\n$ pg2bigquery -d dataset -t tables.json input output\n```\n\nYou need these things to use:\n\n- **input**: input folder that contains PostgresSQL query files\n- **output**: output folder that contains BigQuery query files\n- **dataset**: destination dataset which is used to run BigQuery query\n- **tables**: list of tables of pg database in json file\n\n\u003e If you want to know about the files format, go to [samples](samples)\n\n### Tables JSON file\n\nFor now, you need to put the list of tables in a json file like this:\n\n```json\n[\"forms\", \"roles\", \"steps\", \"wards\", \"people\", \"staffs\", \"products\"]\n```\n\nYou can easily get the list of tables in your sql editor by this query:\n\n```sql\nselect table_name from information_schema.tables;\n```\n\nRun `pg2bigquery` with `--help` option to get more details:\n\n```sh-session\n$ pg2bigquery --help\n```\n\nA success run will be:\n\n```sh-session\n$ pg2bigquery -d dataset -t tables.json input output\ncheck output folder... done\nget input files... 10 files\nget tables... 55 tables\nconvert 10 files... done\n```\n\n# Limitations\n\n\u003e [No Silver Bullet](https://en.wikipedia.org/wiki/No_Silver_Bullet).\n\u003e\n\u003e The converted files might not be perfect.\n\nWhen you use my tool, you will see these cases:\n\n### `No matching signature for operator` (two different types)\n\n```\nNo matching signature for operator = for argument types: INT64, STRING. Supported signature: ANY = ANY at [382:44]\n```\n\nBigQuery don't implicit cast one type to another when using with operators (+, -, \u003c, \u003e,...)\nso you have to do it for yourself.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhckhanh%2Fpg2bigquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhckhanh%2Fpg2bigquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhckhanh%2Fpg2bigquery/lists"}