Saturday, August 18, 2018

Re: [google-cloud-sql-discuss] Re: Unable to connect cloud SQL postgres

Hi George,

I am getting the below error, any help should appreciate.

psycopg2.OperationalError: could not connect to server: No such file or directory
    1. at connect (/env/lib/python3.5/site-packages/psycopg2/__init__.py:130)
    2. at connect (/env/lib/python3.5/site-packages/sqlalchemy/engine/default.py:410)
    3. at connect (/env/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py:106)
    4. at __connect (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:667)
    5. at __init__ (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:477)
    6. at _create_connection (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:350)
    7. at _do_get (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:1186)
    8. at reraise (/env/lib/python3.5/site-packages/sqlalchemy/util/compat.py:187)
    9. at __exit__ (/env/lib/python3.5/site-packages/sqlalchemy/util/langhelpers.py:66)
    10. at _do_get (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:1189)
    11. at checkout (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:532)
    12. at _checkout (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:784)
    13. at connect (/env/lib/python3.5/site-packages/sqlalchemy/pool.py:403)
    14. at _wrap_pool_connect (/env/lib/python3.5/site-packages/sqlalchemy/engine/base.py:2158)
  1. Please let me know, if you any more informaion.
I am using postgres and python3.5, with SQLAchemy 
The database and app engine app, is in same project.

here is my app.yaml file:
runtime: python
env: flex
entrypoint: gunicorn  -c gunicorn.conf.py  -b :$PORT main:app

runtime_config:
  python_version: 3.5

handlers:
- url: /warmup
  script: main.py

- url: /csatai/*
  script: main.py
  secure: always
  redirect_http_response_code: 301

- url: /company/*
  script: main.py
  secure: always
  redirect_http_response_code: 301

  #manual_scaling:
  #instances: 1
  
#[START env]
env_variables:
    # Replace user, password, database, and instance connection name with the values obtained
    # when configuring your Cloud SQL instance.
    SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://<user-id>:<password>@/<db-name>?host=/cloudsql/<db-nstance-id>
#[END env]

#[START cloudsql_settings]
# Replace project and instance with the values obtained  when configuring your
# Cloud SQL instance.
beta_settings:
    cloud_sql_instances: <db-instance-id>
    #[END cloudsql_settings]

On Mon, Aug 6, 2018 at 10:37 PM 'George (Cloud Platform Support)' via Google Cloud SQL discuss <google-cloud-sql-discuss@googlegroups.com> wrote:
Hello Binaya, 

Do you mean you followed the proposed steps after reading my reply, and, as a result, now you can connect to your PostgreSQL instance? If not, what error do you get? Does it differ from the initial error? 

--
You received this message because you are subscribed to a topic in the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-cloud-sql-discuss/lLN2h4muV4k/unsubscribe.
To unsubscribe from this group and all its topics, 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/85e6a9d8-5c72-4d9d-a54e-c260f91c7e73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CAKaZEEoxRmYPhW1LCckRmEFr5QbmqQbRSBw2KRAx2wJBeAmC3w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment