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
load CSV data via COPY command #20
Conversation
@talerngpong Thank you for your contribution! This does the same thing as my PR here #19 and it also handled:
It might be good if you can have a look at that PR and help review it. 😃 |
csv-to-db/docker-compose.yml
Outdated
@@ -9,3 +9,6 @@ services: | |||
- POSTGRES_PASSWORD=kaogeek | |||
ports: | |||
- "5432:5432" | |||
volumes: | |||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this solution is cleaner than my script that manually drop existing and create a new DB. It might be good if you can rebase on top of my latest changes and apply this change to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased.
I am not sure which change I need to apply. Then I comes with questions.
- From my guess, does it mean that I need to remove your previous solution (like
import_data
andrun_sql
shell scripts)? - This PR aims improvement of how we insert data to Postgres (by using
COPY
command). Would it be good whether other thing else could be fulfilled in your PR instead? (by lemme review your PR) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of just:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql | |
- ./create_report_table.sql:/docker-entrypoint-initdb.d/init.sql |
Does this make sense?
c746aa0
to
9894cfa
Compare
csv-to-db/docker-compose.yml
Outdated
@@ -9,3 +9,6 @@ services: | |||
- POSTGRES_PASSWORD=kaogeek | |||
ports: | |||
- "5432:5432" | |||
volumes: | |||
- ./create_report_table.sql:/docker-entrypoint-initdb.d/init.sql | |||
- ../output_example_v2.csv:/usr/src/output_example_v2.csv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this as the thing we import is from here.
@talerngpong Merged! Thanks again for your contribution. |
@vtno Thank you as well. Other changes you interest depend on your branch |
@talerngpong Feel free to open another PR to master to add new features. 🙏 |
Purposed changes:
init.sql
script during spinning container up viadocker compose up -d
copy
SQL command to load CSV data to declared table. This will serve a use case ofImport CSV data with a single command