PyCharm Database View and Google Cloud SQL

PyCharm has really improved my developer productivity.  It has great integration with the Google Apps SDK and with a little tweaking, can support multiple Google Cloud SQL database logins.

The tricky part is managing the stored credentials behind the scenes. Seems like the Google SQL Command Line Tool only supports 1 login at a time. If you are like me and do projects for multiple clients, then you need multiple Google Account logins.

What works pretty easily is swapping out the credential file behind the scenes. Take a look here to find where the Command Line Tool is storing it’s credential:

https://developers.google.com/cloud-sql/docs/commandline#revokeaccess

You can setup the Command Line Tool using your first account, then rename the resulting credential File (or Registry Key in Windows. Setup the Command Line Tool again using your next account, then rename the credential file/key to something else.  Now you can swap your active credential by swapping in the right file/key.  Symbolic links work in Mac/Linux, .reg files to set the right key should work in Windows.

Once you have the right Credential in place, tell PyCharm about the Google Command Line Tool .jar database connector file and you are good to go.  Here’s a picture of my setup.

Setup PyCharm with Google Cloud SQL