将PostgreSQL表复制到GitHub
使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,这不会最终出现在Github上。 Heroku的Github集成仅在一个方向上起作用:从Github到Heroku。它用于部署,而不是双向同步。
/code>命令对git一无所知。当以上面显示的格式使用时:
它将保存到一个名为
artists_export.csv
的文件中,当您在本地计算机上运行命令时,在本地计算机上使用的任何目录。这可能是
c:\ users \ rebecca \
,如果您在Windows上,/users/rebecca/
如果您在MacOS上,/home /rebecca/
如果您在Linux上。或者,它可能是您的项目目录,例如,如果您在连接到数据库之前执行了cd某些/project/directory/code>之类的操作。
与Postgres断开连接,例如,通过键入
,然后查看您的任何目录中的任何目录,以获取一个名为
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: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 likecd some/project/directory/
before connecting to your database.Disconnect from Postgres, e.g. by typing
and then look in whatever directory you're in for a file called
artists_export.csv
.