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 ID of the project that contains the instance.
project = 'xxx1' # TODO: Update placeholder value.
# Database instance ID. This does not include the project ID.
instance = 'xxx2' # TODO: Update placeholder value.
# Database name.
database = 'xxx3' # TODO: Update placeholder value.
#I can get the instance detail
instance = service.instances().get(project=project, instance=instance).execute()
pprint(instance)
#I can get the detail of each user created in the Project
users = service.users().list(project=project, instance=instance).execute()
pprint(users)
#I can get the detail of each database created in the proyect
all_databases = service.databases().list(project=project, instance=instance).execute()
pprint(all_databases)
So the question 1 is: How can i insert data to a specific Table in the Database?
If my table named "table1" is:
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
email VARCHAR(50)
3.- Also, How can I send a query and get the result?