RuntimeError: OperationalError: (2003, Can't connect to MySQL server on 'IPaddress of the instance'

后端 未结 1 768
挽巷
挽巷 2021-01-27 11:38

I\'m trying to run a Python(version 2.7.1\') script where I am using pymysql package to create a table into a database from a CSV file.

It runs

1条回答
  •  有刺的猬
    2021-01-27 11:48

    On Dataflow you cannot whitelist an IP to enable Dataflow to access a SQL instance. If you would be using Java, the easiest way would be to use JdbcIO / JDBC socket factory.

    But since you're using Python, then mimicking the implementation of JdbcIO.read() using Python-specific database connectivity facilities would help. There's this related question with a workaround after changing some Cloud SQL settings and adding related python codes.

    If this seems complex, alternatively you can export data from Cloud SQL to Cloud Storage and then load from Cloud Storage.

    0 讨论(0)
提交回复
热议问题