HomeData scienceMigrating PostgreSQL Knowledge from Native to Google Cloud SQL: A Step-by-Step Information...

Migrating PostgreSQL Knowledge from Native to Google Cloud SQL: A Step-by-Step Information | by Saverio Mazza | Jan, 2024


TrendWired Solutions
Aiseesoft FoneLab - Recover data from iPhone, iPad, iPod and iTunes
IGP [CPS] WW
Managed VPS Hosting from KnownHost

This information will stroll you thru a sensible and environment friendly technique to switch your PostgreSQL knowledge utilizing pg_dump, making an allowance for frequent hurdles corresponding to permission points.

https://github.com/mazzasaverio/fastapi-your-data

Conditions:

  • An area PostgreSQL database.
  • A Google Cloud SQL occasion with PostgreSQL.
  • Entry to Google Cloud Storage.
  • Primary familiarity with command-line instruments and SQL.
PostgreSQL Knowledge from Native to Google Cloud SQL

Step 1

Getting ready Your Native Database for Export Firstly, you must create a dump of your native PostgreSQL desk. It’s essential to exclude possession knowledge to forestall permission points on Cloud SQL. Open your command line software and run:

pg_dump -h localhost -p 5432 -U [local_username] -d [local_database] -t [table_name] --no-owner > table_dump.sql

Substitute [local_username], [local_database], and [table_name] along with your native database credentials and the particular desk you want to migrate.

Step 2

Importing the Dump to Google Cloud Storage After you have your SQL dump file (table_dump.sql), the following step is to add it to Google Cloud Storage. This may be achieved via the Google Cloud Console or utilizing gsutil:

gsutil cp table_dump.sql gs://[your_bucket_name]/

Substitute [your_bucket_name] with the identify of your Google Cloud Storage bucket.

Step 3

Setting Permissions for the Cloud SQL Service Account Earlier than importing the info, make sure the Cloud SQL service account has the mandatory permissions to entry the dump file in Google Cloud Storage. Within the Google Cloud Console:

  • Navigate to your Cloud SQL occasion.
  • Determine the service account utilized by Cloud SQL (normally within the format [instance_name]@service-project-name.iam.gserviceaccount.com).
  • Go to your Google Cloud Storage bucket and add this service account with a minimum of learn permissions.

Step 4



Supply hyperlink

latest articles

Wicked Weasel WW
TurboVPN WW

explore more