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

[I/O] Use cr8 for loading tables from PostgreSQL #147

Open
amotl opened this issue May 17, 2024 · 0 comments
Open

[I/O] Use cr8 for loading tables from PostgreSQL #147

amotl opened this issue May 17, 2024 · 0 comments

Comments

@amotl
Copy link
Member

amotl commented May 17, 2024

About

@hlcianfagna elaborated about typical cr8 usage patterns, which did not make it into the ctk load table interface yet. Thanks!

Details

Regarding copying the content from one table to a new one with different settings/partitioning options/etc, you can use the cr8 insert-from-sql utility. It accepts a --fetch-size parameter which defaults at 100 records, and a --concurrency parameter which defaults at 25.

This tool reads through the PostgreSQL protocol connecting on port 5432, so username and passwords for the source need to be encoded in the connection string. Writing happens through the HTTP endpoint of CrateDB on port 4200, and it can go to a separate cluster.

If your passwords have special characters, you need to encode them properly.

CLI Example

cr8 insert-from-sql \
  --src-uri "postgresql://readuser:readpwd@localhost:5432/doc" --query "SELECT * FROM sourcetable;" \
  --hosts writeuser:writepassword@localhost:4200 --table doc.targettable
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

No branches or pull requests

1 participant