Hi Mike,

You should be able to connect to multiple Cloud SQL instances through Cloud 
SQL Proxy, and you can specify multiple instances in the instances 
parameter (comma separated). Please take a look at these two posts for more 
details: "A GCE instance connecting to two (or more) Cloud SQL databases 
via multiple cloud-sql-proxy-instances 
<https://groups.google.com/forum/#!msg/google-cloud-sql-discuss/_GH4b6Uxz9I/pRE0Z9aTAgAJ>"
 
and "Connecting to multiple CloudSQL instances using Cloud sql proxy? 
<https://stackoverflow.com/questions/40793222/connecting-to-multiple-cloudsql-instances-using-cloud-sql-proxy>",
 
which have the similar questions. 

- Jun


On Friday, November 17, 2017 at 12:06:49 AM UTC-5, Mike Hardy wrote:
>
> Hi, we have an app that utilizes two databases. Previously, we had the two 
> databases on the same instance in Cloud SQL, but we want to split the 
> databases into separate instances. We're having issues connecting the 
> databases to our Django app engine service. Is this even possible? If so, 
> how would the app.yaml look?
>
> old app.yaml
> runtime: custom
> env: flex
> entrypoint: gunicorn --timeout 360 --graceful-timeout 360 -b :$8080 
> localinsights.wsgi
>
> beta_settings:
>     cloud_sql_instances: <CONNECTION>
>
> runtime_config:
>   python_version: 3.6
>
> env_variables:
>   SQLALCHEMY_DATABASE_URI: >-
>       
> postgresql+psycopg2://<USER>:<PASSWORD>/<DB>?host=/cloudsql/<CONNECTION>
>
>
> settings.py
> DATABASES['default'] = {
>     'HOST': '/cloudsql/<CONNECTION>',
>     'ENGINE': 'psqlextra.backend',
>     'NAME': '<USER_DB>',
>     'USER': '<USER>',
>     'PASSWORD': '<PASSWORD>'
> }
> DATABASES['NUMBER_2'] = {
>     'HOST': '/cloudsql/<CONNECTION>',
>     'ENGINE': 'psqlextra.backend',
>     'NAME': 'NUMBER_2',
>     'USER': '<USER>',
>     'PASSWORD': '<PW>'
> }
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/7ad41428-ccf4-4ce3-8f35-453ecdab5e0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to