Pushing a db from my local computer via the command line

Greetings!
I am hoping to use Aiven to set up very simple, almost no use psql db. It currently exists only on my local computer. I have been trying to use pg_dump O, along with the link to my Aiven db. Unfortunately I am unable to get the connection to work. How should I be pushing a db from my local compute to Aiven from the command line?

Thank you!

pg_dump doesn’t use the -O option to specify an output, if that’s what you were thinking. It does something else that you probably don’t want. You would normally use standard output like pg_dump ... > out.dmp.

If you use pg_dump to create a non-SQL PostgreSQL dump using one of the non-default -F options, you would use pg_restore to connect to the database and restore the specified dump, perhaps in part. It does take a filename as one of its parameters.

If you create an SQL-based text dump, you can just feed it into the psql command (again, with suitable options), like: psql .... < file.sql. Usually scripts will contain the necessary information to create the database structure as well as fill in the data, but you might need to specify certain options when creating the dump in the first place (with this format, it’s harder to change afterwards).

Be sure to read the “Connecting to the database” section of the psql documentation for how to specify your connection - this is usually done via a “connection string” that contains all necessary arguments and options. In fact, I’ve always felt the PostgreSQL documentation is pretty good, so I’d recommend reading as much of it as you can. :smirk_cat: