Thanks for this. The second link is to the flex environment documentation. Are you saying that App Engine standard 2nd gen uses the same method of connecting to CloudSQL instances as flex, i.e. via the unix socket
/cloudsql/INSTANCE_CONNECTION_NAME ? If so, it would be helpful to have those instructions/example on the first link (to standard 2nd gen) as well.
Personally, I would like to see an example that doesn't depend on SQLAlchemy + Flask, otherwise people may think they have to use those. I guess it's not hard to figure out but just some acknowledgement that you can set your own environment variables and manually use them to connect with pymysql or whatever adapter.