Skip to content

Commit

Permalink
chore: update readme and keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
hckhanh committed Dec 8, 2020
1 parent ac771a2 commit 7249a14
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 21 deletions.
102 changes: 82 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,92 @@ pg2bigquery

A CLI tool to convert query from PostgreSQL to BigQuery

![Release](https://github.com/hckhanh/pg2bigquery/workflows/Release/badge.svg)
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/pg2bigquery.svg)](https://npmjs.org/package/pg2bigquery)
[![Downloads/week](https://img.shields.io/npm/dw/pg2bigquery.svg)](https://npmjs.org/package/pg2bigquery)
[![License](https://img.shields.io/npm/l/pg2bigquery.svg)](https://github.com/hckhanh/pg2bigquery/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Installation

For npm:

```shell
npm i -g pg2bigquery
```

or yarn:

```shell
yarn global add pg2bigquery
```

# Usage
<!-- usage -->

## Requirements

```sh-session
$ npm install -g pg2bigquery
$ pg2bigquery COMMAND
running command...
$ pg2bigquery (-v|--version|version)
pg2bigquery/0.0.0 win32-x64 node-v14.15.0
$ pg2bigquery --help [COMMAND]
USAGE
$ pg2bigquery COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->

<!-- commandsstop -->
$ pg2bigquery -d dataset -t tables.json input output
```

You need these things to use:

* **input**: input folder that contains PostgresSQL query files
* **output**: output folder that contains BigQuery query files
* **dataset**: destination dataset which is used to run BigQuery query
* **tables**: list of tables of pg database in json file

### Tables JSON file

For now, you need to put the list of tables in a json file like this:

```json
[
"forms",
"roles",
"steps",
"wards",
"people",
"staffs",
"products"
]
```

You can easily get the list of tables in your sql editor by this query:

```sql
select table_name from information_schema.tables;
```

You can run `pg2bigquery` with `--help` option to get more details:

```sh-session
$ pg2bigquery --help
```

A success run will be:

```sh-session
$ pg2bigquery -d dataset -t tables.json input output
checking output folder... done
getting input files... 10 files
getting tables... 55 tables
converting 10 files... done
```

# Limitations

> [No Silver Bullet](https://en.wikipedia.org/wiki/No_Silver_Bullet).
>
> The converted files might not be perfect.
When you use my tool, you will see these cases:

### `No matching signature for operator` (two different types)

```
No matching signature for operator = for argument types: INT64, STRING. Supported signature: ANY = ANY at [382:44]
```

BigQuery don't implicit cast one type to another when using with operators (+, -, <, >,...)
so you have to do it for yourself.
19 changes: 18 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,24 @@
],
"homepage": "https://github.com/hckhanh/pg2bigquery",
"keywords": [
"oclif"
"pg",
"postgresql",
"postgres",
"big",
"bigquery",
"sql",
"query",
"converter",
"convert",
"transfer",
"tool",
"cli",
"database",
"data",
"db",
"google",
"utility",
"utilities"
],
"license": "MIT",
"main": "lib/index.js",
Expand Down

0 comments on commit 7249a14

Please sign in to comment.