hi -

work with mysqlclient first so you can determine if this is an error:

import MySQLdb

conn = MySQLdb.connect(user='user', passwd='passwd', db='dbname',
unix_socket='/cloudsql/myproject:europe-west1:airflowinstance')
cursor = conn.cursor()
cursor.execute("select 1")

see http://mysqlclient.readthedocs.io/user_guide.html#mysqldb.  If you
can get that to work then I can show you how to make whatever
parameters you end up with work with SQLAlchemy.



On Fri, Nov 10, 2017 at 2:31 AM,  <james.ll...@netnatives.co.uk> wrote:
> Hello.
>
> I'm using the SQL Cloud Proxy on a Compute engine VM instance. I'm then
> configuring Airflow (which uses SQL Alchemy).
>
> I've setup a unix socket like this:
>
> /opt/cloud_sql_proxy/cloud_sql_proxy
> -instances=myproject:europe-west1:airflowinstance -dir=/cloudsql &
>
>
> I can connect to the Cloud SQL Proxy using this socket without any trouble.
> i.e.,
>
> mysql -u airflowuser -p -S /cloudsql/myproject:europe-west1:airflowinstance
>
> But I can't get Airflow to connect using the below connection string:
>
> sql_alchemy_conn =
> mysql://airflowuser:xxx@/airflowdatabase?unix_socket=/cloudsql/myproject:europe-west1:airflowinstance
>
> I get a 'connection refused' error.
>
> Any help much appreciated!
>
>
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to