Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform PSQL2BigQuery into a CLI #9

Merged
merged 18 commits into from
Nov 3, 2021
Merged

Transform PSQL2BigQuery into a CLI #9

merged 18 commits into from
Nov 3, 2021

Conversation

joaodaher
Copy link
Contributor

@joaodaher joaodaher commented Oct 6, 2021

Description

Fixes #5 #4

@joaodaher joaodaher marked this pull request as ready for review October 12, 2021 23:08
@joaodaher joaodaher self-assigned this Oct 12, 2021
It does not behave as expected: since we want to allow running with env vars, the prompt will always ask for input
The auto-detect can cause issues when the sample is not good enough.
We've got issues with columns that most of records are numbers, but some records have alpha characters, causing the load to fail.
Now that the import is more reliable, we can be more strict and do not allow any record to be discarded
@@ -1 +1,12 @@
psql2bigquery
# PostgreSQL to BigQuery

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really good add a readme to project =D
What do you think about add a how-to run local to help developers contribute to the project

Copy link
Contributor Author

@joaodaher joaodaher Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added a new commit with a Contributing section.
Please tell me if there's anything I could add.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @joaodaher!

I'd be great to have more usage instructions and examples with the available params. Can you add that as well please?

It could also be in a different issue/PR, no problem. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A note that could be added to the instructions: --include and --exclude are mutually exclusive, so they can't be used together.

And here's the syntax for multiple tables (worth mentioning in the readme or command help):

poetry run psql2bigquery run --db-host localhost \
--db-port 5430 \
--db-user whatsgood \
--db-password xx \
--db-name whatsgood \
--gcp-project whatsgood-dev \
--gcp-dataset api \
--include membership_membership \
--include membership_membershipprogram \
--gcp-credential-path /Users/tferreira/project/psql2bigquery/whatsgood-dev.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a basic usage example for now.
We can improve later with a proper documentation of each parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @joaodaher, thanks!

Copy link
Contributor

@thiagoferreiraw thiagoferreiraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaodaher, something is not quite right with the logs, can you look into, please? Nothing is being printed to stdout 😱

(but the table is being sent to bigquery correctly ✅ looks like an issue just in the logs)

Here is my command:

poetry run psql2bigquery run --db-host localhost \
--db-port 5430 \
--db-user whatsgood \
--db-password xx \
--db-name whatsgood \
--gcp-project whatsgood-dev \
--gcp-dataset api \
--include crm_crmbackend \
--gcp-credential-path /Users/tferreira/project/psql2bigquery/whatsgood-dev.json

image

@joaodaher
Copy link
Contributor Author

@thiagoferreiraw , it was missing the log level for stdout. I added in a new commit.

@thiagoferreiraw thiagoferreiraw merged commit 0f4faef into main Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transform psql2bigquery into a friendly CLI
3 participants