Wednesday, April 10, 2019

[google-cloud-sql-discuss] Add data to Google Cloud SQL from Google Compute Engine using python

I need to be able to send data from GCE (Google compute engine) to a Table in Google Cloud SQL

Reding the documentation i found:

from pprint import pprint
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials

credentials = GoogleCredentials.get_application_default()
service = discovery.build('sqladmin', 'v1beta4', credentials=credentials)

project  = 'xx1'   # TODO: Update placeholder value.
instance = 'xx2'   # TODO: Update placeholder value.
database = 'xx3'   # TODO: Update placeholder value.

And with this documentation link , i did could get the information of users and all database created in Google Cloud SQL (It worked)

users       = service.users().list(project=project, instance=instance).execute()
pprint(users)  # List of user 

all_databases   = service.databases().list(project=project, instance=instance).execute()
pprint(all_databases)


My question is:
I have a Database created in Google Cloud SQL
I have a Table created in the Database

How can i insert data to the Table from Google Compute Engine? I cannot find documentation. Could anyone help me?

Regards....






--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/fc8da141-6e94-47e7-af55-7af027789302%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment