문제

현재 로컬 컴퓨터를 사용하여 데이터를 조작하여 Google App Engine을 웹 서비스 및 Google 클라우드 SQL을 호스팅하여 데이터베이스를 처리합니다. 그러나 내 데이터를 먼저 GAE에 업로드 한 다음 GAE에서 백엔드 작업을 실행하여 모든 데이터를 Google 클라우드 SQL에 업로드하십시오. 데이터를 두 번 업로드하기 위해 낭비하는 시간입니다. 내 로컬 컴퓨터에서 Google Cloud SQL에서 Google Cloud SQL에서 직접 가져 오거나 업데이트하고 싶습니다.

현재 Google Cloud SQL은 Client로 Google App Engine 만 완전히 지원했습니다.

Google 클라우드 SQL은 현재 Google App Engine에서만 사용할 수 있습니다. 응용 프로그램. Google App Engine 응용 프로그램을 개발하려면 Python 또는 Java에서 사용할 수있는 App Engine SDK를 설치하십시오.

그러나 Google Cloud SQL은 JAR DB 드라이버를 제공합니다. LINE 클라이언트 / 다람쥐 로컬 컴퓨터에서 SQL 클라이언트 액세스. 로컬 컴퓨터 에서이 JAR을 통해 클라우드 SQL과 상호 작용하기 위해 Java 코드를 작성할 수있는 것처럼 보입니다. 또는 "NoFollow"> jpype 와 같은 도구를 사용하여 Python을 통해 Google Cloud SQL에 액세스 할 수 있습니다.

가능합니까? 어디에서 시작해야합니까? 아니면 로컬 컴퓨터에서 파이썬을 사용하여 Google Cloud SQL에 액세스 할 수있는 대안이 있습니까?

https://developers.google.com/cloud-sql/docs/commandline <. / a>

http://jpype.sourceforge.net/

도움이 되었습니까?

해결책 2

I found a way to connect google cloud sql from python via SDK

def connect_sql(instance, database = None):
    from google.storage.speckle.python.tool import google_sql    
    database = google_sql.DatabaseConfig(instance, database)

    sql_cmd_config = google_sql.config.SQLCmdConfig(None)
    sql_cmd_config.add('__googlesql__', instance, None, None, database,
                    google_sql.GoogleSqlDriver.NAME, None, None)
    sql_cmd = google_sql.GoogleSqlCmd(sql_cmd_config)
    sql_cmd.set_database(instance)

    sql_cmd.preloop()
    return sql_cmd._SQLCmd__db

다른 팁

This tool is new to me!

If this tool exists, why don't you use it to upload your data to Cloud SQL?

At the time of this writting, there's no official support to connect to Google Cloud SQL from the outside world. Google said is planning to allow access from anywhere in the near future.

In conclusion, try using this tool to upload your data. Using appengine as a middleware could be costly depending on the size of your data.

Cloud SQL now supports the native MySQL wire protocol [1], so you can use standard connectors such as Connector/Python [2]

  1. https://developers.google.com/cloud-sql/docs/external#wireprotocol
  2. http://dev.mysql.com/downloads/connector/python/
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top