0

I'm following this tutorial: https://learn.microsoft.com/en-us/azure/postgresql/howto-migrate-using-export-and-import

I've successfully created a script file using pg_dump. I ran this on my command line:

pg_dump –-host=local --username=postgres --dbname=satellite_data --file=satellite_data.sql

I'm now at the point where I have to use psql to import the data into my Azure Server for PostgreSQL (https://learn.microsoft.com/en-us/azure/postgresql/howto-migrate-using-export-and-import#import-the-data-on-target-azure-database-for-postgresql).

I used the command the tutorial suggested psql --file=<database>.sql --host=<server name> --port=5432 --username=<user> --dbname=<target database name>. I ran this in the Azure cloud shell (bash). With my info, it was:

psql --file=satellite_data.sql --host=[redacted] --port=5432 --username=[redacted] --dbname=satellite_data

However, I get the following error:

psql: error: satellite_data.sql: No such file or directory

I have tried saving satellite_data.sql in many locations (and then passing the full file path to --file in azure), but nothing works.

I've followed the tutorial, and nothing seems to fix the error. Intuitively, I can't see how Azure can access my local file system... but that's what they seemingly do in the tutorial.

How can I fix this error?

jack.py
  • 362
  • 8
  • 23
  • 1
    Yes that guide is very light on details. You can actually raise a git issue for the doco and ask for more detail. In the meantime, this might help you work out where you need to save your file and how to access it (ignore the Power BI bits) https://www.sqlchick.com/entries/2018/12/9/how-to-reference-azure-storage-files-from-cloud-shell – Nick.Mc Aug 08 '21 at 06:21

1 Answers1

0

When running the psql --file=<database>.sql --host=<server name> --port=5432 --username=<user> --dbname=<target database name> command, it must be run from your command line, not the Azure Cloud Shell.

Then, it should work.

jack.py
  • 362
  • 8
  • 23