You are using the Cloud SQL Admin API which is meant for administering your instances programmatically. It is not supposed to be used to save data to Cloud SQL databases.
I did not find sample code designed to save data to a specific table. However, you can start by testing the sample code in this document.
Note that Google Groups is not the best place to post this type of question. If you still have questions please open a post in Stack Overflow.
Hello everyone,from pprint import pprintfrom googleapiclient import discoveryfrom oauth2client.client import GoogleCredentialscredentials = 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 detailinstance = service.instances().get(project=project, instance=instance).execute() pprint(instance)#I can get the detail of each user created in the Projectusers = service.users().list(project=project, instance=instance).execute() pprint(users)#I can get the detail of each database created in the proyectall_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?
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/70c597d9-fab1-4db7-947e-ccf4bace9cf3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment