سؤال

أنا حاليا باستخدام جهازي المحلي الخاص بي لمعالجة البيانات ومحرك تطبيقات Google لاستضافة خدمة الويب الخاصة بي و Google Cloud SQL للتعامل مع قاعدة البيانات. ومع ذلك، أحتاج إلى تحميل بياناتي إلى GAE أولا، ثم قم بتشغيل مهمة خلفية على GAE لتحميل جميع البيانات إلى Google Cloud SQL لاحقا. لقد مضيعة الوقت لتحميل البيانات مرتين. أرغب في استيراد / تحديث بعض التاريخ من جهازك المحلي إلى Google Cloud SQL مباشرة.

الآن، قام Google Cloud SQL فقط بمحرك Google App الخاص ب Google كعميله.

Google Cloud SQL متاح حاليا فقط لمحرك Google App التطبيقات. لتطوير تطبيقات محرك تطبيق Google، تحتاج إلى قم بتثبيت محرك APP SDK، متوفر إما Python أو Java:

ومع ذلك، نظرا لأن Google Cloud SQL يوفر جرة DB DB خط عميل / Squirrel SQL وصول عميل من الجهاز المحلي. يبدو أنه يمكنني كتابة بعض رمز Java للتفاعل مع SQL Cloud SQL عبر هذه الجرة في الجهاز المحلي. أو يمكنني استخدام أدوات مثل JPype للوصول إلى Google Cloud SQL عبر Python.

هل هذا ممكن؟ أين يجب أن تبدأ؟ أم أن هناك أي طريقة بديلة يمكنني استخدام Python على الجهاز المحلي للوصول إلى Google Cloud SQL؟

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

p> 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