Programming,  Python

Google Cloud Function To Add JSON To A Cloud SQL Database

Here’s a Google Cloud Function that takes some arbitrary json (in json_data) and posts it to a new record in a Cloud SQL database. No error handling or deduplication/matching, just a straight post:

https://github.com/krypted/tinyconverters/blob/548892cc377e1063770ab4a8cd53dc6573bae950/json_to_cloud_SQL.py

Before using, it needs information to connect to the database, so customize the INSTANCE_NAME, DATABASE_NAME, and TABLE_NAME for the INSERT. For more on Cloud SQL, see https://cloud.google.com/sql/docs.