将PostgreSQL表复制到GitHub

发布于 2025-02-13 09:52:08 字数 475 浏览 0 评论 0原文

使用Heroku CLI并关注这些说明 ,我试图将DB表作为CSV保存。

我可以在CLI上看到表,当我使用复制命令时,我会看到:

baer-faxt-prod::DATABASE-> \COPY artists TO 'artists_export.csv' WITH (FORMAT csv, DELIMITER ',',  HEADER true);
COPY 1010

它似乎已经成功了,但是我在Github上看不到它。

我对使用这个CLI和Heroku一般不了解。有人为我们设置了一段时间,我们需要移动数据库。

如果不是github,则文件在哪里?

Using the Heroku CLI and following these instructions, I am trying to save the DB tables as CSVs.

I can see the tables on the CLI and when I use the copy command I see:

baer-faxt-prod::DATABASE-> \COPY artists TO 'artists_export.csv' WITH (FORMAT csv, DELIMITER ',',  HEADER true);
COPY 1010

It seems to have been successful, but I don't see it on GitHub.

I know very little about using this CLI and Heroku in general. Someone had set this up for us a while back and we need to move the DB.

If not GitHub, where does the file go?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清秋悲枫 2025-02-20 09:52:08

当然,这不会最终出现在Github上。 Heroku的Github集成仅在一个方向上起作用:从Github到Heroku。它用于部署,而不是双向同步。

/code>命令对git一无所知。当以上面显示的格式使用时:

\COPY artists TO 'artists_export.csv' WITH (FORMAT csv, DELIMITER ',',  HEADER true);

它将保存到一个名为artists_export.csv的文件中,当您在本地计算机上运行命令时,在本地计算机上使用的任何目录。

这可能是c:\ users \ rebecca \,如果您在Windows上,/users/rebecca/如果您在MacOS上,/home /rebecca/如果您在Linux上。或者,它可能是您的项目目录,例如,如果您在连接到数据库之前执行了cd某些/project/directory/code>之类的操作。

与Postgres断开连接,例如,通过键入

\quit

,然后查看您的任何目录中的任何目录,以获取一个名为artists_export.csv的文件。

This certainly won't end up on GitHub. Heroku's GitHub integration works in one direction only: from GitHub to Heroku. It is used for deployment, not for bidirectional syncing.

The PostgreSQL \COPY command doesn't know anything about Git. When used in the format you show above:

\COPY artists TO 'artists_export.csv' WITH (FORMAT csv, DELIMITER ',',  HEADER true);

it saves to a file called artists_export.csv in whatever directory you are in on your local machine when you run the command.

That might be something like C:\Users\Rebecca\ if you're on Windows, /Users/Rebecca/ if you're on macOS, /home/rebecca/ if you're on Linux. Or, it could be your project directory, for example if you did something like cd some/project/directory/ before connecting to your database.

Disconnect from Postgres, e.g. by typing

\quit

and then look in whatever directory you're in for a file called artists_export.csv.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文